settings
Persistent key-value store for script/tool settings, backed by a JSON file in the user’s config directory.
settings.Set
Section titled “settings.Set”settings.Set(key: string, value: any): ()
Sets a key to any Lua value in the settings table and persists it to disk immediately.
settings.Set("debug_logs", true)settings.Get
Section titled “settings.Get”settings.Get(key: string, default: any?): any
Returns the stored value for key, or the given default if the key is absent or nil.
local speed = settings.Get("walk_speed", 16)settings.Has
Section titled “settings.Has”settings.Has(key: string): boolean
Returns true if key exists in the settings table with a non-nil value.
if settings.Has("debug_logs") then print("set") endsettings.Remove
Section titled “settings.Remove”settings.Remove(key: string): boolean
Deletes key from the settings table, persists the change, and returns whether the key had been present.
local existed = settings.Remove("old_key")settings.Keys
Section titled “settings.Keys”settings.Keys(): {string}
Returns an array table of all keys currently in the settings table.
for _, k in settings.Keys() do print(k) endsettings.All
Section titled “settings.All”settings.All(): {[string]: any}
Returns a shallow copy of the entire settings table.
local all = settings.All()settings.Clear
Section titled “settings.Clear”settings.Clear(): ()
Empties the settings table and persists the empty state to disk.
settings.Clear()settings.Save
Section titled “settings.Save”settings.Save(): ()
Explicitly writes the current settings table to disk; redundant with the auto-persist done by Set/Remove/Clear but kept as a defensive flush point.
settings.Save()settings.Load
Section titled “settings.Load”settings.Load(): ()
Reloads the settings table from disk, discarding any in-memory changes not yet persisted.
settings.Load()settings.Path
Section titled “settings.Path”settings.Path(): string
Returns the absolute filesystem path to the settings JSON store.
print(settings.Path())