Gkini: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
No edit summary
m Added GeSHi
Line 30: Line 30:
<br><br>
<br><br>
'''Example:'''<br>
'''Example:'''<br>
gkini.ReadInt("Vendetta", "showhelpstring", 1) -> 0
<source lang="lua">gkini.ReadInt("Vendetta", "showhelpstring", 1) -> 0 -- showhelpstring is ccurrently set to 0</source>
showhelpstring is ccurrently set to 0
<br><br>
<br><br>


Line 50: Line 49:
<br><br>
<br><br>
'''Example:'''<br>
'''Example:'''<br>
gkini.ReadString("Vendetta", "Username", "dude") -> "hans"
<source lang="lua">gkini.ReadString("Vendetta", "Username", "dude") -> "hans" -- get the default username from the config file</source>
get the default username from the config file
<br><br>
<br><br>


Line 71: Line 69:
<br><br>
<br><br>
'''Example:'''<br>
'''Example:'''<br>
gkini.WriteInt("Vendetta", "showhelpstring", 1)
<source lang="lua">gkini.WriteInt("Vendetta", "showhelpstring", 1) -- change the showhelpstring option to 1</source>
change the showhelpstring option to 1
<br><br>
<br><br>


Line 92: Line 89:
<br><br>
<br><br>
'''Example:'''<br>
'''Example:'''<br>
gkini.WriteString("Vendetta", "Username", "dude")
<source lang="lua">gkini.WriteString("Vendetta", "Username", "dude") -- change the Username option to dude</source>
change the Username option to dude  
<br><br>
<br><br>

Revision as of 22:22, 23 September 2007

These are functions to manipulate the games config file config.ini.

The format of the file looks like this:

[section]
key=value
.
.

value can either be a string or an integer all identifiers are case sensitive



Functions

ReadInt

Definition:
ReadInt(string section, string key, int default) -> int value

Description:
Read and integer the provided section and key

Arguments:
section a section of the config file
key key within a section
default value to return if key not found

Returns:

Example:
<source lang="lua">gkini.ReadInt("Vendetta", "showhelpstring", 1) -> 0 -- showhelpstring is ccurrently set to 0</source>


ReadString

Definition:
ReadString(string section, string key, string default) -> string value

Description:
Read and integer the provided section and key

Arguments:
section a section of the config file
key key within a section
default value to return if key not found

Returns:

Example:
<source lang="lua">gkini.ReadString("Vendetta", "Username", "dude") -> "hans" -- get the default username from the config file</source>


WriteInt

Definition:
WriteInt(string section, string key, int value) -> nil

Description:
Write an integer to the provided section and key

Arguments:
section a section of the config file
key key within a section
value value of a key as an integer

Returns:

Example:
<source lang="lua">gkini.WriteInt("Vendetta", "showhelpstring", 1) -- change the showhelpstring option to 1</source>


WriteString

Definition:
WriteString(string section, string key, string value) -> nil

Description:
Write an integer to the provided section and key

Arguments:
section a section of the config file
key key within a section
value value of a key as a string

Returns:

Example:
<source lang="lua">gkini.WriteString("Vendetta", "Username", "dude") -- change the Username option to dude</source>