Skip to main content

Config

The config module loads Lua configuration files from the consuming resource and caches the result. It can validate loaded values with the validator module before returning them.

Load a config file

config/settings.lua
shared.lua
File paths are normalized before loading, so config/settings.lua resolves through the same module-style path as config.settings.

Cache and reload

config:load(filePath, schema?) returns the cached value after the first read. If you pass a schema later, the cached value is still validated before it is returned.

Safe environment

Config files run with a small environment that includes common Lua helpers and vector constructors.
A missing file raises [sure_lib][config] cannot load file: <path>. A schema failure raises [sure_lib][config] validation failed in <path>: ....