Skip to content

pos.Config

Peter edited this page Mar 19, 2024 · 1 revision

Class: Config

Config access class

Constructor: _G.pos.Config(path: string, default?: table, createDef?: boolean)

Creates a config object

Parameters

  • path: string - Path to the config file
  • default?: table - (Optional) Default config values
  • createDef?: boolean - (Optional) If the file does not exits, create default config at path

Fields

Variable Description
path: string Path to normal config file
data: table Config data
default: table Default config data
loaded: boolean If the config has been loaded from file

Instance Functions

Signature Return Description
__init__(path, default, createDef?) nil PACKAGE Initialize the config object
load(path?) boolean Load the config from file
loadDef(path?) boolean Load the config from file, or create a default one at the path
save(path?) boolean Saves the config to file
saveAll(path?) boolean Saves the config, including default values, to file

Detail

Functions

__init__

Queue:__init__(path: string, default: table, createDef?: boolean): nil

PACKAGE

Initialize the config object

Parameters

  • path: string - Path to the config file
  • default: table - Default config values
  • createDef?: boolean - (Optional) If the file does not exits, create default config at path

load

Queue:load(path?: string): boolean

Load the config from file

Parameters

  • path?: string - (Optional) Temporary path to load config from

Returns

  • loaded: boolean

loadDef

Queue:loadDef(path?: string): boolean

Load the config from file, or create a default one at the path

Parameters

  • path?: string - (Optional) Temporary path to load config from

Returns

  • loaded: boolean

save

Queue:save(path?: string): boolean

Saves the config to file

Parameters

  • path?: string - (Optional) Temporary path to save config to

Returns

  • saved: boolean

saveAll

Queue:saveAll(path?: string): boolean

Saves the config, including default values, to file

Parameters

  • path?: string - (Optional) Temporary path to save config to

Returns

  • saved: boolean