ini parsing library implemented by pure lua.
Lini = require 'Lini'
ini = Lini.load_from_file('test.ini')
Lini = require 'Lini'
ini = Lini.load_from_string('[section]\nabc=111')
Lini = require 'Lini'
a = {}
a['section'] = {}
a['section']['test'] = 111
Lini.write_to_file('a.ini', a)
...
ini_str = Lini.write(a)
[section.subsection]
will be prased into:
ini = {
section = {
subsection = {
...
}
}
}
Lines, keys and values' starting and ending Spaces will be removed in praser. If an ini file don't start with a section like [section name]
, it will be prased into:
ini = {
k = v,
k2 = v2,
...
}
The format of the comments is ;comments
, so you can't use ;
in section name, key or value.