This function reads the data name at the specified index from an .ini file.
- bool ReadIniIndex( string filename, string section, int index )
- filename This is the name of the file
- section The section that contains the value you want read
- index The index in the ini (starting at 0)
- function onPlayerCommand( player, cmd, text )
- if ( cmd == "readindex" )
- if ( text )
- local message = ReadIniIndex( text, player.Name, 0 );
- MessagePlayer( message, player );
This will message the player with the index 0, from the section labeled as their name in the file that they specify.
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.
These functions are provided by the official module lu_ini.