Skip to content

Nyx.Settings ​

The typed settings registry: registration, values, watchers and profiles, plus Namespace, the entry point a third-party rotation uses to register its own settings without colliding with the framework or with another author's keys.

27 entry points, 11 documented.

Settings.Signal ​

lua
Settings.Signal(key, value, old, profile)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Watch ​

lua
Settings.Watch(key, fn, onDrop)

Calls fn(key, value, old, profile) whenever key's effective value changes, including on Reset and on a profile switch. profile names the bucket the change landed in -- see notify() above for why that argument exists. A key of "*" is not a literal key: it subscribes fn to every key's changes, keyed watchers and all. fn runs inside pcall, so a watcher whose frame has gone away cannot stop the value being applied or the other watchers from hearing about it -- a throwing watcher is dropped rather than retried. Returns a watcher id for Unwatch, or nil if key or fn is the wrong type.

Settings.lua

Settings.Unwatch ​

lua
Settings.Unwatch(id)

Removes one watcher by the id Watch returned. Returns true if a watcher was removed, false if that id does not exist (already unwatched, or never existed) -- never throws.

Settings.lua

Settings.ActiveProfile ​

lua
Settings.ActiveProfile()

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.ValidProfileName ​

lua
Settings.ValidProfileName(name)

A profile name is what the user types, so it is trimmed and bounded here rather than trusted. It is also a table key in the saved chunk, which %q escapes safely, so no character class needs excluding.

Settings.lua

Settings.Profiles ​

lua
Settings.Profiles()

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.SetActiveProfile ​

lua
Settings.SetActiveProfile(name)

Switching swaps which table profile-scoped reads land in. Global values are untouched by design: theme and window geometry follow the operator.

Settings.lua

Settings.CreateProfile ​

lua
Settings.CreateProfile(name, copyFrom)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.RenameProfile ​

lua
Settings.RenameProfile(oldName, newName)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.DeleteProfile ​

lua
Settings.DeleteProfile(name)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Register ​

lua
Settings.Register(def)

Registers one setting. Re-registering the same key (a hot reload) refreshes the definition but keeps the current value.

Settings.lua

Settings.Get ​

lua
Settings.Get(key, fallback)

Reads the effective value of a registered key: whatever was last Set, or its definition's default if it never was. fallback is returned ONLY when key was never Register()ed at all -- a registered key with no stored value yields its default, never fallback.

Settings.lua

Settings.Set ​

lua
Settings.Set(key, value)

Coerces value through the key's kind, bounds and validate function, stores it, and returns the applied value -- which may differ from what was passed in. Notifies watchers only if the applied value actually changed. A key that was never Register()ed is refused: returns nil and stores nothing.

Settings.lua

Settings.Reset ​

lua
Settings.Reset(key)

Restores a setting to its default and returns it. The stored value is removed rather than overwritten, so the key stops being serialized at all.

Settings.lua

Settings.Definitions ​

lua
Settings.Definitions()

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Definition ​

lua
Settings.Definition(key)

One definition by key. Definitions() returns the whole ordered list and is what the menu is generated from; a wildcard watcher needs exactly one per notification and must not walk that list to find it.

Settings.lua

Settings.Normalize ​

lua
Settings.Normalize(key, value)

Coerces value to key's kind and bounds -- the same normalize/validate path Set() applies -- WITHOUT storing anything or notifying a watcher. Returns nil for an unregistered key. Exists for a caller that needs to land a value in a specific profile's bucket directly (Profiles.lua's ProfileImport, writing into a profile that may not be the active one) without borrowing Set()'s "always writes to whichever profile is active" behaviour.

Settings.lua

Settings.PrepareOwner ​

lua
Settings.PrepareOwner(owner, definitions, watcherSpecs)

Build a complete next registry/value/watcher set for one plugin owner. Stored values are copied and normalized in the candidate so a rejected generation cannot even transiently alter dormant data.

Settings.lua

Settings.ApplyPrepared ​

lua
Settings.ApplyPrepared(prepared)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.PreparedGet ​

lua
Settings.PreparedGet(prepared, key, fallback)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.PreparedSet ​

lua
Settings.PreparedSet(prepared, key, value)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.PreparedReset ​

lua
Settings.PreparedReset(prepared, key)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.RemoveOwner ​

lua
Settings.RemoveOwner(owner)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Namespace ​

lua
Settings.Namespace(prefix, owner)

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Serialize ​

lua
Settings.Serialize()

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Save ​

lua
Settings.Save()

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

Settings.Flush ​

lua
Settings.Flush()

UNDOCUMENTED

This exists but has no comment in the source yet.

Settings.lua

API reference generated from source.