ini.encode(value)

Encode a Lua table in a ini representation string.

Parameters

value

The table to be encoded to ini format. The table must follow the following rules :
  • The table must contain only string keys, each with an associated sub-table
  • In e of those sub-tables, the key/pair values will be converted to string

Return value

Returns the encoded ini string or a nil value in case of error.

Example

local ini = require "ini" local t = { user1 = { name = "John", age = 38, sex = "male" }, user2 = { name = "Jane", age = 26, sex = "female" } } -- prints the table content encoded in ini format print(ini.encode(t))