ini.load(file)

Load and decode a file containing ini data, 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

file

A File object or a filename string, representing the file whose content will be decoded from ini.

Return value

Returns the corresponding Lua table or a nil value in case of error.

Example

local ini = require "ini" -- Load the old but still alive Windows "system.ini" file local system = ini.load(sys.env.windir.."/system.ini") -- prints the content of the 'wave' key in the section 'drivers' print(system.drivers.wave)