Kryzeth Standard Library

StdLib.Misc.Config

supers: StdLib.Core

For working with mod configurations.

@usage require('kry_stdlib/stdlib/config/config')

Methods6

function Config.new()
function Config.get()
function Config.set()
function Config.delete()
function Config.is_set()
function Config.new(config_table: table) -> StdLib.Misc.Config

Creates a new Config object to ease the management of a config table.

Parameters
config_tabletable

the config table to manage

Returns
StdLib.Misc.Config

the Config object to manage the config table

@usage --[Use a global table for config that persists across game save/loads] CONFIG = Config.new(global.testtable)

@usage --[You can also create a temporary scratch pad config] CONFIG = Config.new({}) -- Temporary scratch pad

@usage --[Setting data in Config] CONFIG = Config.new(global.testtable) CONFIG.set("your.path.here", "myvalue")

@usage --[Getting data out of Config] CONFIG = Config.new(global.testtable) my_data = CONFIG.get("your.path.here")

@usage --[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")

@usage --[Deleting a path from Config] CONFIG = Config.new(global.testtable) CONFIG.delete("your.path.here")

@usage --[Checking if a path exists in Config] CONFIG = Config.new(global.testtable) CONFIG.is_set("your.path.here")

Fields2

Config.__class: string = "Config"
Config.__index : unknown