ini.decode(string)
Decode an ini string to a Lua table, following those rules :
- Each ini section is a key in the returned table, that contains a table
- Each section table contains pairs of key/value strings
Parameters
string
ini string to be decoded.
Return value
Returns the corresponding Lua table or anil
value in case of error.
Example
local ini = require "ini"
-- sample ini string, that contains two sections of key/value fields
content = [[
[John]
age=32
gender=male
[Lena]
age=26
gender=female
]]
local users = ini.decode(content)
-- prints the age of the user John
print(users.John.age)