Squirrel/Server/Functions/Ini/WriteIniFloat
From Liberty Unleashed Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|WriteIniFloat}} | |
+ | {{RequiresModule|lu_ini|Modules/Squirrel/lu_ini}} | ||
This function writes a float value to an .ini file. If the file does not exist, the function will create it. | This function writes a float value to an .ini file. If the file does not exist, the function will create it. | ||
Latest revision as of 10:29, 11 October 2010
Note: This function requires the external module lu_ini.
This function writes a float value to an .ini file. If the file does not exist, the function will create it.
[edit] Syntax
bool WriteIniFloat( string filename, string section, string var, float value )
[edit] Arguments
- filename This is the name of the file
- section The section that contains the value you want to create/edit
- var The name of the variable
- value The float value for the variable
[edit] Example
This example will save a location to a file 'Locations.ini' when a player types '/saveloc LocationName'.
function onPlayerCommand( player, command, text ) { if ( command = "saveloc" ) { local pos = player.Pos; WriteIniFloat( "Locations.ini", text, "x", pos.x ); WriteIniFloat( "Locations.ini", text, "y", pos.y ); WriteIniFloat( "Locations.ini", text, "z", pos.z ); MessagePlayer( "Saved location " + text + ".", player ); } }
[edit] Notes
The functions Player.Pos, MessagePlayer and call onPlayerCommand were also used in in this example. More info about them in the corresponding pages.
[edit] Related Functions
These functions are provided by the official module lu_ini.