Module l2df.config

Last updated 2021-05-28 15:24:22

Configs and settings

Info:

Functions

Config:all([group]) Combine and return full config for the specified group / all groups.
Config:group(group, ...) Create new config's group and assign key-paths to it.
Config:get(key) Get config value by key-path.
Config:set(key, value[, group]) Update pair in config and set assign it to specified group if needed.
Config:load(filepath[, group[, reset=false]]) Load config to specified group / all groups from JSON file.
Config:save(filepath[, group]) Save config for specified group / all groups to JSON file.


Functions

Methods
Config:all([group])
Combine and return full config for the specified group / all groups.

Parameters:

  • group string Specified group. (optional)

Returns:

    table
Config:group(group, ...)
Create new config's group and assign key-paths to it.

Parameters:

Config:get(key)
Get config value by key-path.

Parameters:

  • key string Key-path in format 'path.to.value'.

Returns:

    mixed
Config:set(key, value[, group])
Update pair in config and set assign it to specified group if needed.

Parameters:

  • key string Key-path in format 'path.to.value'.
  • value mixed Value.
  • group string Specified group. (optional)
Config:load(filepath[, group[, reset=false]])
Load config to specified group / all groups from JSON file.

Parameters:

  • filepath string Path to JSON config.
  • group string Specified group. (optional)
  • reset boolean Reset already loaded config. (default false)
Config:save(filepath[, group])
Save config for specified group / all groups to JSON file.

Parameters:

  • filepath string Path to JSON config.
  • group string Specified group. (optional)