Beispiel #1
0
func loadFloat(dat *wini.Data, name, key string, target *float64) {
	k := dat.GetKey(name, key)
	if k == nil {
		utils.Fail("Missing key " + key + " in section " + name)
	}

	tmp, err := k.Floats()
	utils.FailMeMaybe(err)

	if len(tmp) > 0 {
		*target = tmp[0]
	} else {
		utils.Fail("Missing key " + key + " in section " + name)
	}
}
Beispiel #2
0
func loadString(dat *wini.Data, name, key, def string, target *string) {
	k := dat.GetKey(name, key)
	if k == nil {
		if def == "" {
			utils.Fail("Missing key " + key + " in section " + name)
		} else {
			*target = def
			return
		}
	}

	tmp := k.Strings()

	if len(tmp) > 0 {
		*target = tmp[0]
	} else {
		if def == "" {
			utils.Fail("Missing key " + key + " in section " + name)
		} else {
			*target = def
			return
		}
	}
}