Config: Difference between revisions

From Crumbled World Wiki
(Created page with "{{:ConfigExampleCode}} ==Constructor== {| class="wikitable" !|function !|description |- |Config(string configName) | |- |} ==Functions== {| class="wikitable" !|return !|function !|description |- | |save() |saves the config to file |- |ConfigItem |get(string name) |returns a configItem |- |ConfigItem |get(string name,double val) |returns a configItem. if item do not...")
(No difference)

Revision as of 14:21, 5 July 2025

ConfigExampleCode

Constructor

function description
Config(string configName)

Functions

return function description
save() saves the config to file
ConfigItem get(string name) returns a configItem
ConfigItem get(string name,double val) returns a configItem. if item do not exist set default value to val
ConfigItem get(string name,string val) returns a configItem. if item do not exist set default value to val
ConfigItem get(string name,Vec2 val) returns a configItem. if item do not exist set default value to val
ConfigItem get(string name,Vec3 val) returns a configItem. if item do not exist set default value to val
ConfigItem get(string name,Vec4 val) returns a configItem. if item do not exist set default value to val
Table getTable() returns a complete table with all the children and there values. it will return an empty table if isData()==true.
renameChild(string oldName,string newName) renames the item with the exakt name.
remove(string name) removes the item with the exakt name.
bool isData() returns false. because the first layer must be a table.
bool exist(string name) returns true if there is a child with that exakt name.
ConfigItem getFirst() returns first element of its table
ConfigItem getNext() returns next element in the table
string getCurrentName() returns the name of the active element in the table
bool isEnd() returns true if this is the last element in queue