Gkini: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
New page: These are functions to manipulate the games config file config.ini. The format of the file looks like this:<b> [section]<br> key=value<br> .<br> .<br> value can either be a string or an ...
 
No edit summary
Line 1: Line 1:
These are functions to manipulate the games config file config.ini.
These are functions to manipulate the games config file config.ini.


The format of the file looks like this:<b>
The format of the file looks like this:
 
[section]<br>
[section]<br>
key=value<br>
key=value<br>
Line 8: Line 9:


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


== Functions ==
== Functions ==
Line 52: Line 56:




=== WriteString ===
=== WriteInt ===
'''Definition:'''<br>
'''Definition:'''<br>
WriteString(string section, string key, string value) -> nil
WriteInt(string section, string key, int value) -> nil
<br><br>
<br><br>
'''Description:''' <br>
'''Description:''' <br>
Line 62: Line 66:
'''section''' a  section of the config file<br>
'''section''' a  section of the config file<br>
'''key''' key within a section<br>
'''key''' key within a section<br>
'''value''' value of a key as a string
'''value''' value of a key as an integer
<br><br>
<br><br>
'''Returns:'''
'''Returns:'''
<br><br>
<br><br>
'''Example:'''<br>
'''Example:'''<br>
gkini.WriteString("Vendetta", "Username", "dude")
gkini.WriteInt("Vendetta", "showhelpstring", 1)
change the Username option to dude
change the showhelpstring option to 1
<br><br>
<br><br>




=== WriteInt ===
 
=== WriteString ===
'''Definition:'''<br>
'''Definition:'''<br>
WriteInt(string section, string key, int value) -> nil
WriteString(string section, string key, string value) -> nil
<br><br>
<br><br>
'''Description:''' <br>
'''Description:''' <br>
Line 82: Line 87:
'''section''' a  section of the config file<br>
'''section''' a  section of the config file<br>
'''key''' key within a section<br>
'''key''' key within a section<br>
'''value''' value of a key as an integer
'''value''' value of a key as a string
<br><br>
<br><br>
'''Returns:'''
'''Returns:'''
<br><br>
<br><br>
'''Example:'''<br>
'''Example:'''<br>
gkini.WriteInt("Vendetta", "showhelpstring", 1)
gkini.WriteString("Vendetta", "Username", "dude")
change the showhelpstring option to 1
change the Username option to dude
<br><br>
<br><br>

Revision as of 19:24, 19 July 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:
gkini.ReadInt("Vendetta", "showhelpstring", 1) -> 0 showhelpstring is ccurrently set to 0


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:
gkini.ReadString("Vendetta", "Username", "dude") -> "hans" get the default username from the config file


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:
gkini.WriteInt("Vendetta", "showhelpstring", 1) change the showhelpstring option to 1


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:
gkini.WriteString("Vendetta", "Username", "dude") change the Username option to dude