Plugin context
API 2 plugins receive a context as the vararg of init.lua. The context is scoped to the plugin owner: it is the only supported way for an author to register rotations, settings, pages and assets.
10 entry points, 10 documented.
plugin.require
lua
plugin.require(name)Loads a Lua module below this plugin's base directory; traversal and absolute paths are refused.
PluginContext.lua
plugin.log
lua
plugin.log(...)Writes a plugin-prefixed diagnostic to the Nyx engine log.
PluginContext.lua
plugin.asset
lua
plugin.asset(name)Declares an Assets/*.png resource owned by this plugin and returns its canonical path.
PluginContext.lua
plugin.rotation:Register
lua
plugin.rotation:Register(definition)Registers one rotation definition owned by this API 2 plugin.
PluginContext.lua
plugin.settings:Register
lua
plugin.settings:Register(definition)Registers a setting with a local id; the framework prefixes it with this plugin owner.
PluginContext.lua
plugin.settings:Get
lua
plugin.settings:Get(name, fallback)Reads an owned setting, returning fallback when the name is not registered or live.
PluginContext.lua
plugin.settings:Set
lua
plugin.settings:Set(name, value)Sets an owned setting and returns the applied value, or nil and a reason on rejection.
PluginContext.lua
plugin.settings:Reset
lua
plugin.settings:Reset(name)Restores an owned setting to its declared default.
PluginContext.lua
plugin.settings:Watch
lua
plugin.settings:Watch(name, fn)Watches an owned setting and returns a token for Unwatch.
PluginContext.lua
plugin.settings:Unwatch
lua
plugin.settings:Unwatch(id)Removes a watcher token returned by Watch.
PluginContext.lua