Scripting/Squirrel/Functions/DeleteIniSection
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
This function deletes a selected section from a ini file.
Syntax
DeleteIniSection( 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 a sample ini file 'hastalavista.ini'. You can copy and paste this:
[useful info]
A = aaa
b = BBB
[spam]
Nothing to see here = true
[players]
1 = nub
2 = nab
3 = noob
Now we want to delete the '[spam]' section. Let's do this, when the server starts.
function onServerStart()
{
DeleteIniSection( "hastalavista.ini", "spam" );
}
After this check the ini file. It should look like this:
[useful info]
A = aaa
b = BBB
[players]
1 = nub
2 = nab
3 = noob
Notes
The call OnServerStart was used in in this example. More info about this in the corresponding page.