Squirrel/Server/Functions/Ini/CountIniSection
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function counts the items in the given .ini file section. == Syntax == <code>int CountIniSection( string file, string section )</code> == Arguments == * '''file''' - The...) |
|||
Line 13: | Line 13: | ||
== Example == | == Example == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( player, cmd, text ) | |
+ | { | ||
+ | if ( cmd == "clearsection" ) | ||
+ | { | ||
+ | if ( text ) ClearIniSection( text, player.Name ); | ||
+ | } | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This will clear the section which is labeled as the players name in the given ini file. | ||
=== Notes === | === Notes === | ||
− | + | The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/Ini}} | {{Squirrel/Server/Functions/Ini}} |
Revision as of 01:19, 8 March 2010
This function counts the items in the given .ini file section.
Syntax
int CountIniSection( string file, string section )
Arguments
- file - The name of the .ini file
- section - The section from which the items should be counted
Example
function onPlayerCommand( player, cmd, text ) { if ( cmd == "clearsection" ) { if ( text ) ClearIniSection( text, player.Name ); } }
This will clear the section which is labeled as the players name in the given ini file.
Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.
Related Functions
These functions are provided by the official module lu_ini.