Lua API Overview
The complete public scripting API, one page per namespace. For a task-oriented introduction, start with Scripting Basics and The Scripting Model.
| Namespace | Page | What it does |
|---|---|---|
rune.send, rune.connect, … |
Core | Sending, connecting, loading scripts, quitting |
rune.state, rune.line |
State & Lines | Read-only client state; the line object contract |
rune.style |
rune.style | ANSI color and attribute helpers |
rune.regex |
rune.regex | Go-regexp matching, validation, compilation |
rune.trigger |
rune.trigger | React to server output |
rune.alias |
rune.alias | Expand and transform your input |
rune.timer |
rune.timer | One-shot and repeating timers |
rune.hooks |
rune.hooks | Event handlers, plus the full event catalog |
rune.bind |
rune.bind | Key binding registration and management |
rune.command |
rune.command | Custom /commands |
rune.group |
rune.group | Batch enable/disable across registries |
rune.gmcp |
rune.gmcp | GMCP handlers, sending, subscriptions |
rune.http |
rune.http | Async HTTP requests with callbacks |
rune.input, rune.history |
rune.input | The input line and command history |
rune.session, rune.store, rune.world |
Storage | Session and durable storage; world bookmarks |
rune.log |
rune.log | Session logging |
rune.ui |
rune.ui | Layout, bars, bar management |
rune.ui.picker |
rune.ui.picker | Fuzzy-filter selection panels |
rune.pane |
rune.pane | Scrollable text panes |
Also in Reference: the built-in slash commands and the protocols rune negotiates on the wire.
The contracts below apply across the API; individual pages link here rather than restating them.
Handles
Section titled “Handles”Every creation function (rune.trigger.*, rune.alias.*,
rune.timer.*, rune.hooks.on, rune.bind, rune.ui.bar,
rune.gmcp.on, rune.command.add) returns a handle:
| Method | Effect |
|---|---|
h:enable() / h:disable() |
Toggle without unregistering |
h:remove() |
Unregister (timers also accept h:cancel()) |
h:name() |
The item’s name, or nil |
h:group() |
The item’s group, or nil |
h:action() |
The registered action: the function, or the string for string actions |
Methods are chainable. See The Scripting Model for usage.
h:action() returns the callback as registered, so calling it runs
neither the enabled and group checks nor the failure quarantine. It is
for capturing an existing action and wrapping it, not for dispatch.
A registration’s name identifies it in
get, enable, disable and remove, replacement registrations,
and listing commands. Unnamed registrations are managed through their handles.
Most registries take the name from you. Four take it from what you passed first:
| Creation function | Name | Because |
|---|---|---|
rune.trigger.* |
the name you give it |
several triggers can match one line |
rune.alias.regex |
the name you give it |
several can match one line |
rune.timer.* |
the name you give it |
nothing about a timer is unique |
rune.hooks.on |
the name you give it |
several handlers per event |
rune.gmcp.on |
the name you give it |
several handlers per package |
rune.bind |
the key, "ctrl+g" |
one bind per key |
rune.ui.bar |
the bar name, "status" |
one renderer per named bar |
rune.command.add |
the command, "greet" |
one handler per /command |
rune.alias.exact |
the phrase, "chat off" |
one expansion per typed phrase |
Use opts.name to distinguish registrations that can share the same first
argument. Functions with one registration per key, bar, command, or phrase
use that argument as the name.
Either way the management calls look the same:
rune.trigger.contains("food", "eat bread", { name = "feeder" })rune.bind("ctrl+g", toggle_map)
rune.trigger.disable("feeder")rune.binds.disable("ctrl+g")That is also why rune.binds.disable("ctrl+g") and
rune.bars.get("status") reach the core’s own binds and bars, which are
registered without options at all.
For the four automatically named functions, opts.name is ignored with a
notice stating the registration’s name.
Options
Section titled “Options”Common opts fields accepted by every creation function:
| Option | Type | Default | Applies to |
|---|---|---|---|
group |
string | none | All: membership for batch operations |
priority |
number | 50 | Regex aliases, triggers, hooks. Lower runs first |
once |
bool | false | Aliases, triggers. Remove after first match |
name sets the name where the registry does not set its own; see
Names. Page-specific extras (e.g. trigger gag/raw) are
listed on each page.
Managing
Section titled “Managing”Every registry namespace exposes the same functions, each taking the item’s name:
| Function | Effect |
|---|---|
.get(name) |
The item’s handle, or nil |
.enable(name) / .disable(name) |
Enable or disable an item |
.remove(name) |
Unregister an item |
.list() |
All items with name, enabled state, group, and source file:line |
.count() |
Number of registered items |
.clear() |
Remove everything in the registry |
.remove_group(group) |
Remove all items in a group |
The bar registry also exposes .toggle(name), returning whether that bar
exists. See rune.ui.
The matching slash commands — /triggers, /aliases, /timers,
/hooks, /binds, /bars — print the same listings.
Quarantine
Section titled “Quarantine”A callback that errors 3 times consecutively is disabled individually,
with a notice. Re-enable it (.enable(name)), re-register it, or
/reload to reset the count; one successful run also clears it. See
The Scripting Model.
Related: The Scripting Model · Slash Commands · Protocols