ConfigItem

From Crumbled World Wiki

ConfigItemExampleCode

Constructor

function description
ConfigItem(string fileName) opens that specific config files using a singleton.

Functions

return function description
set(nil) Can set any value of type number,string,boolean,Vec2,Vec3,Vec4,Matrix,table
setBool(bool val) sets the boolean, int, float and double value.
setInt(int val) sets the boolean, int, float and double value.
setFloat(float val) sets the boolean, int, float and double value.
setDouble(double val) sets the boolean, int, float and double value.
setString(string str) sets string value of item.
setVec2(Vec2 vec) sets vec value of item.
setVec3(Vec3 vec) sets vec value of item.
setVec4(Vec4 vec) sets vec value of item.
setVec4(Matrix mat) sets the matrix as value. This variable can't be saved to file
setTable(table tab) inserts a table that merges with current table values.
nil get() returns current value of types number,string,boolean,Vec2,Vec3,Vec4,Matrix,table
bool getBool() returns current boolean value.
int getInt() returns current int value.
float getFloat() returns current float value.
double getDouble() returns current double value.
string getString() returns current string value.
Vec2 getVec2() returns current Vec2 value.
Vec3 getVec3() returns current Vec3 value.
Vec4 getVec4() returns current Vec4 value.
Matrix getMatrix() returns current Matrix. the matrix can't be loaded from file
Table getTable() returns a complete table with all the children and there values. it will return an empty table if isData()==true.
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
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 true if there is no children to item.
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