What it does
settings
Settings tab for the System Tools inspector — auto-generated controls
for /zero/source/.world_settings. Reads through the global settings
module (TOML parsing centralised there) and renders each
[section].key as an inspector field. Loads the disk file ONCE on
mount and saves on edit; there is no per-frame disk poll.
Exports
M.onMount(_state)— lifecycle hook; lazy-loads the settings doc into the cache.M.build(_state) -> any— build the inspector widget tree.M.onCallback(callbackId: string, data, _state) -> boolean— handle Reload + per-key set callbacks.M.label: string— tab title.M.refresh: number— refresh cadence in seconds (0 = input-driven).
Usage
local Settings = require("@builtin::modules.engine.editor.system_tools.tabs.settings")
Settings.onMount(state)
local widget = Settings.build(state)
Settings.onCallback("settings-reload", nil, state)
Notes
- The cache is invalidated by the Reload button (or by mounting a
fresh instance). Other writers to
.world_settingswill not be reflected until Reload is pressed. - Field kind is inferred from the current value: booleans become checkboxes; whole-number floats become int spinners; non-whole floats stay as float spinners; everything else becomes a text input.
- Sub-tables and arrays under a
[section]are skipped — the inspector renders scalar leaves only. - Save coerces the input back to the current type before calling
settings.set.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.