For working with mod configurations.
require('__stdlib__/stdlib/config/config')
new(config_table) | Creates a new Config object to ease the management of a config table. |
get(path[, default]) | Get a stored config value. |
set(path, data) | Set a stored config value. |
delete(path) | Delete a stored config value. |
is_set(path) | Test the existence of a stored config value. |
Config |
Creates a new Config object to ease the management of a config table.
Parameters:
--[Use a global table for config that persists across game save/loads]
CONFIG = Config.new(global.testtable)
--[You can also create a temporary scratch pad config]
CONFIG = Config.new({}) -- Temporary scratch pad
--[Setting data in Config]
CONFIG = Config.new(global.testtable)
CONFIG.set("your.path.here", "myvalue")
--[Getting data out of Config]
CONFIG = Config.new(global.testtable)
my_data = CONFIG.get("your.path.here")
--[Getting data out of Config with a default to use if path is not found in Config]
CONFIG = Config.new(global.testtable)
my_data = CONFIG.get("your.path.here", "Your Default here")
--[Deleting a path from Config]
CONFIG = Config.new(global.testtable)
CONFIG.delete("your.path.here")
--[Checking if a path exists in Config]
CONFIG = Config.new(global.testtable)
CONFIG.is_set("your.path.here")
Get a stored config value.
Parameters:
Set a stored config value.
Parameters: