Skip to content

settings

Persistent key-value store for script/tool settings, backed by a JSON file in the user’s config directory.

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(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(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") end

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(): {string}

Returns an array table of all keys currently in the settings table.

for _, k in settings.Keys() do print(k) end

settings.All(): {[string]: any}

Returns a shallow copy of the entire settings table.

local all = settings.All()

settings.Clear(): ()

Empties the settings table and persists the empty state to disk.

settings.Clear()

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(): ()

Reloads the settings table from disk, discarding any in-memory changes not yet persisted.

settings.Load()

settings.Path(): string

Returns the absolute filesystem path to the settings JSON store.

print(settings.Path())