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...") |
|||
| Line 24: | Line 24: | ||
|[[Config:get(string name)|get]]([[string]] name) | |[[Config:get(string name)|get]]([[string]] name) | ||
|returns a configItem | |returns a configItem | ||
|- | |||
|[[ConfigItem]] | |||
|[[Config:get(string name, bool val)|get]]([[string]] name,bool val) | |||
|returns a configItem. if item do not exist set default value to val | |||
|- | |- | ||
|[[ConfigItem]] | |[[ConfigItem]] | ||
Latest revision as of 08:04, 26 July 2025
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,bool val) | returns a configItem. if item do not exist set default value to val |
| 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 |