Scripting/Squirrel/Functions/Ini/DeleteIniSection

From VC-MP Wiki

Jump to: navigation, search

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.

Related Functions

Personal tools
squirrel scripting