Scripting/Squirrel/Functions/CountIniSection: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "__NOTOC__ This function says, how many values/lines are in a selected section in an ini file. == Syntax == <code>CountIniSection( string FileName, string Section )</code> =...") |
No edit summary |
||
Line 32: | Line 32: | ||
} | } | ||
</code> | </code> | ||
== Notes == | |||
The call [[OnServerStart]] was used in in this example. More info about this in the corresponding page. | |||
== Related Functions == | |||
{{Scripting/Squirrel/Functions/INI Functions}} |
Revision as of 04:56, 22 June 2016
This function says, how many values/lines are in a selected section in an ini file.
Syntax
CountIniSection( string FileName, string Section )
Arguments
- FileName - This is the file name
- Section - The section name. Use without "[" and "]"
Example
To see how this works, let's create (oh yeah, again) a sample ini file 'hola.ini'. You can copy and paste this:
[Players]
1 = TheTammer
2 = TheSpaner
3 = TheHaxor
4 = TheCheatzor
[Nothing]
Nothing = true
We want to know how many values/lines are in the '[Players]' section. As you can see, there are 4 values in the section. But we want, that the script will tell us this.
function onServerStart()
{
print( "There are " + CountIniSection( "hola.ini", "Players" ) + " players saved." );
}
Notes
The call OnServerStart was used in in this example. More info about this in the corresponding page.