Squirrel/Server/Functions/Ini/ReadIniString
From Liberty Unleashed Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
{{Squirrel/Title|ReadIniString}} | {{Squirrel/Title|ReadIniString}} | ||
+ | {{RequiresModule|lu_ini|Modules/Squirrel/lu_ini}} | ||
__NOTOC__ | __NOTOC__ | ||
This function reads a string saved to an .ini file. | This function reads a string saved to an .ini file. |
Latest revision as of 15:48, 7 August 2012
Note: This function requires the external module lu_ini.
This function reads a string saved to an .ini file.
[edit] Syntax
string ReadIniString( string filename, string section, string var )
[edit] Arguments
- filename This is the name of the file
- section The section that contains the value you want to read
- var The name of the variable
[edit] Example
This example will check whether the player connects from the same IP than earlier and auto-logs them in.
function onPlayerJoin( player ) { if ( ReadIniString( "IPs.ini", "IP", player.Name ) == player.IP ) { /* some nice autologin stuff here */ MessagePlayer( "You have auto-logged in successfully!", player ); } }
[edit] Notes
The functions Player.IP, MessagePlayer and call onPlayerJoin were also used in in this example. More info about them in corresponding pages.
[edit] Related Functions
These functions are provided by the official module lu_ini.