KKConfig Class Reference
| Inherits from | NSObject |
| Declared in | KKConfig.h |
Overview
Access to configuration values loaded from config.lua – individual branches of the configuration values tree (lua table) can be selected and traversed.
Tasks
-
+ loadConfigLuaCalled once by Kobold2D at system startup to run the config.lua script. Expects a table to be returned.
-
+ dumpConfigLuaDumps the entire config.lua table (actually, it’s Objective-C representation as a NSDictionary) to the console, for debugging purposes.
-
+ selectKeyPath:Select the part of the Lua table given by the key respectively key path (using dot notation). Returns YES if the path exists, otherwise return NO.
-
+ selectRootPathSelects the root of the table.
-
+ dictionaryForKey:Get the Lua table dictionary from the currently selected key path.
-
+ stringForKey:Get the string from the currently selected key path.
-
+ numberForKey:Get the NSNumber from the currently selected key path.
-
+ floatForKey:Get the float from the currently selected key path.
-
+ intForKey:Get the int from the currently selected key path.
-
+ boolForKey:Get the bool (as int) from the currently selected key path.
-
+ injectPropertiesFromKeyPath:target:Directly sets the target’s matching properties from the path in the config table. Only float, int, BOOL or NSString properties are supported. All properties must match the corresponding Lua type. Does not change the selected key path.
Class Methods
boolForKey:
Get the bool (as int) from the currently selected key path.
+ (BOOL)boolForKey:(NSString *)keyDeclared In
KKConfig.hdictionaryForKey:
Get the Lua table dictionary from the currently selected key path.
+ (NSDictionary *)dictionaryForKey:(NSString *)keyDeclared In
KKConfig.hdumpConfigLua
Dumps the entire config.lua table (actually, it’s Objective-C representation as a NSDictionary) to the console, for debugging purposes.
+ (void)dumpConfigLuaDeclared In
KKConfig.hfloatForKey:
Get the float from the currently selected key path.
+ (float)floatForKey:(NSString *)keyDeclared In
KKConfig.hinjectPropertiesFromKeyPath:target:
Directly sets the target’s matching properties from the path in the config table. Only float, int, BOOL or NSString properties are supported. All properties must match the corresponding Lua type. Does not change the selected key path.
+ (void)injectPropertiesFromKeyPath:(const NSString *const)keyPath target:(id)targetDeclared In
KKConfig.hintForKey:
Get the int from the currently selected key path.
+ (int)intForKey:(NSString *)keyDeclared In
KKConfig.hloadConfigLua
Called once by Kobold2D at system startup to run the config.lua script. Expects a table to be returned.
+ (void)loadConfigLuaDeclared In
KKConfig.hnumberForKey:
Get the NSNumber from the currently selected key path.
+ (NSNumber *)numberForKey:(NSString *)keyDeclared In
KKConfig.hselectKeyPath:
Select the part of the Lua table given by the key respectively key path (using dot notation). Returns YES if the path exists, otherwise return NO.
+ (BOOL)selectKeyPath:(const NSString *const)keyPathDiscussion
The key path can be written just like you would access a nested Lua table: @“MyParams.Player.AnimationFrames”. Once a part of the table is “selected” you can then use the “ForKey” methods to read individual entries of that part of the table by using one of the xxxForKey methods.
Declared In
KKConfig.h