WriteIniFloat

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events
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.

Syntax

  1. bool WriteIniFloat( string filename, string section, string var, float value )

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

Example

This example will save a location to a file 'Locations.ini' when a player types '/saveloc LocationName'.

  1.  
  2. function onPlayerCommand( player, command, text )
  3. {
  4. if ( command = "saveloc" )
  5. {
  6. local pos = player.Pos;
  7.  
  8. WriteIniFloat( "Locations.ini", text, "x", pos.x );
  9. WriteIniFloat( "Locations.ini", text, "y", pos.y );
  10. WriteIniFloat( "Locations.ini", text, "z", pos.z );
  11.  
  12. MessagePlayer( "Saved location " + text + ".", player );
  13. }
  14. }
  15.  

Notes

The functions Player.Pos, MessagePlayer and call onPlayerCommand were also used in in this example. More info about them in the corresponding pages.

Related Functions

These functions are provided by the official module lu_ini.

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox