Config
config.json declares settings that the game presents to the user. Their current Lua values are stored in the global Config table.
Config is available in main.lua and a Reflex server.lua. It is an empty table when the module declares no settings.
Entries from config.json appear on the built-in settings screen for the selected module; the module does not need to draw those controls itself. The Config table exposes values, but assigning it from Lua is not a way to update that screen or save a new user default. Use Storage for local runtime data.
How a setting is processed
Section titled “How a setting is processed”The game reads config.json, validates types and limits, creates built-in controls, and fills Config with saved values. Module code only reads the resulting table and decides where each setting is applied.
Changing a setting in the UI saves the value and refills the client Config table. Reflex server values are provided when the server part of the module is loaded or reloaded; Config is not a separate runtime command channel.
Minimal config.json
Section titled “Minimal config.json”The file belongs in the module root. Its root must be a JSON array:
[ { "label": "Show panel", "key": "ShowPanel", "type": "bool", "value": true }, { "label": "Panel scale", "key": "PanelScale", "type": "number", "value": 1, "min": 0.5, "max": 2 }]Use the values from Lua:
if Config.ShowPanel then local scale = Config.PanelScale -- Draw the panelendCommon fields
Section titled “Common fields”| Field | Type | Description |
|---|---|---|
label |
string |
Setting label shown in the interface. |
key |
string |
Value key in the Config table. |
type |
string |
Setting type. |
value |
type-specific | Initial value. |
min |
number |
Optional lower limit for number. |
max |
number |
Optional upper limit for number. |
options |
string[] |
Options for enum and maskenum. |
Field names use lowercase spelling exactly as shown.
Setting types
Section titled “Setting types”{ "label": "Show panel", "key": "ShowPanel", "type": "bool", "value": true}Lua receives a boolean.
number
Section titled “number”{ "label": "Panel scale", "key": "PanelScale", "type": "number", "value": 1, "min": 0.5, "max": 2}Lua receives a number. The value is clamped to min…max when loaded. A value of 999 with max = 20 became 20, and -999 with min = 0 became 0.
{ "label": "Panel color", "key": "PanelColor", "type": "color", "value": [0.1, 0.7, 1, 0.8]}Lua receives a Color. The JSON array contains r, g, b, and a. Each component is clamped to 0…1 when loaded.
{ "label": "Panel side", "key": "PanelSide", "type": "enum", "value": 1, "options": ["Left", "Center", "Right"]}Both value and Lua use a zero-based option index:
| Option | Value |
|---|---|
Left |
0 |
Center |
1 |
Right |
2 |
maskenum
Section titled “maskenum”{ "label": "Visible sections", "key": "VisibleSections", "type": "maskenum", "value": ["Health", "Ammo"], "options": ["Health", "Armor", "Ammo"]}Lua receives a numeric bit mask. Selecting the first and third options produces 5 (1 + 4).
| Option | Bit |
|---|---|
| first | 1 |
| second | 2 |
| third | 4 |
Changing Config from Lua
Section titled “Changing Config from Lua”Config is a regular Lua table. Code can temporarily replace a value, even outside min/max:
Config.PanelScale = 999The file constraints are not applied to this assignment. However, changing any setting through the UI repopulates the entire client-side table with the current saved configuration.
Use Config as the source of user settings, not as persistent internal storage. Use Storage for module data.
Reflex server
Section titled “Reflex server”Declared settings are available in server.lua when the script loads. Its update lifecycle differs from the client:
- a UI setting change immediately repopulates the client
Configtable; - it did not update the already-running table in
server.lua; - after a
server.luahot reload, the server received the saved values.
Do not assume the server sees a setting change immediately. Reload the server script or explicitly send the value through Network.
Common mistakes
Section titled “Common mistakes”- using a JSON object instead of an array at the root;
- using an option string instead of a numeric
enumindex; - expecting a string table from
maskenuminstead of a number; - using
Configfor persistent internal module data.