the LIB_INI is used to access/save/load parameters in a text file
Main function is Tinikey.Read(URL) to access/create the INI file. If there’s nothing, it will be created.
Any parameter in the text file is written in the following way
KEY=VALUE
KEY=VALUE1,VALUE2,VALUE3
Keys are always uppercase.
You can create a combination key/value using the following functions
Tinikey.Set("KEY1","VALUE")
Tinikey.Define("KEY1","Value")
with SET you can create a combination, while DEFINE creates the combinations ONLY if it doesn’t exist. Otherwise the value in the file have precedence.
Tinikey.Save()
will save (to the file) all the keys-value combinations.
Tinikey.Reload()
will force a reload of the content, clearing every data first.
Tinikey.Exist(KEY)
returns TRUE if the key exists.
Tinikey.Check(KEY,VALUE)
returns TRUE if the keys exists and it has the same value of VALUE
Tinkey.Get(KEY)
Tinkey.GetInt(KEY)
Tinkey.GetFloat(KEY)
These will return – for the given KEY – a string, an Integer or a Float
It’s possibile to have the list of all the keys saved
Local keys:String[]=Tinikey.GetKeys()
Otherwise you can retrieve, in a single command, all the values in the INI file
Local arr:String[]=Tinikey.GetKeyValues()
You can extract the values of a key, like in the following example
Tinikey.Define("OPTIONS","ALFA,BETA,GAMMA")
Local arr:string[]=Tinikey.GetValues("OPTIONS")
Arr (as an array) will contain ‘ALFA, BETA and GAMMA’
You can also store in a KEY an array with the following command
Tinikey.SetValues("MULTI",array:string[])
The last option is to remove a key from the INI file
Tinikey.RemoveKey(KEYNAME)
of course you must remember to save (with Tinikey.Save()) to write the changes to the file.