Core
The top-level functions on the rune table. For a task-oriented
introduction, see Scripting Basics.
Quick reference
Section titled “Quick reference”rune.send(text) -- process aliases and expansion, then sendrune.send_raw(text) -- straight to the socket, no processingrune.echo(text) -- print to the local display onlyrune.connect(address) -- "host:port", optional tls:// schemerune.disconnect() -- close the connectionrune.load(path) -- run a Lua script; true, or nil + errorrune.reload() -- tear down the VM, re-run core + user scriptsrune.quit() -- exit the client
rune.config_dir -- path to the config directory (data, not a function)rune.version -- client version stringrune.debug -- set true to enable rune.dbg outputrune.dbg(msg) -- print msg, but only while rune.debug is truerune.echo prints locally and never touches the server — pair it with
rune.style for colored messages. rune.reload
tears down the Lua VM and re-runs the core plus your scripts;
rune.session state survives it.
rune.send
Section titled “rune.send”rune.send(text)text(string) — input to process exactly as if you had typed it.
The full input pipeline: ; splits the text into separate commands,
#N repeats expand, and each command runs through
aliases before going to the server. Repeats
are anchored at command position — #3 north repeats, but
say #3 cheers is chat text and passes through untouched. Alias
expansions are processed recursively (nested aliases work), with a
depth limit to catch loops.
rune.send("#2 {get bread bag;eat bread}") -- get/eat, twicerune.send_raw
Section titled “rune.send_raw”rune.send_raw(text) -> true | nil, errtext(string) — sent to the server as-is: no aliases, no;splitting, no#Nrepeats.
Returns true, or nil plus an error message (which is also echoed)
when the send fails — typically because you’re disconnected. This is
what alias and trigger string actions ultimately call.
rune.connect
Section titled “rune.connect”rune.connect(address)address(string) —host:portwith an optional scheme prefix:
| Form | Connection |
|---|---|
host:port |
Plain telnet (default) |
tls://host:port |
TLS, certificate verified |
tls+insecure://host:port |
TLS, no verification (self-signed certs) |
The full address, scheme included, is what
rune.state.address reports and what
the core stores for /reconnect. Connecting is asynchronous — the
"connecting" and "connected" hook events
report progress.
rune.connect("tls://mud.example.com:4000")rune.load
Section titled “rune.load”rune.load(path) -> true | nil, errpath(string) — path to a Lua script;~expands to your home directory.
Runs the script immediately and returns true, or nil plus an error
message. While the script runs, its directory temporarily joins
package.path, so it can require() files relative to its own
location:
~/.config/rune/├── init.lua -- main script├── combat.lua -- require("combat")└── utils/ └── helpers.lua -- require("utils.helpers")-- In init.lua:local combat = require("combat") -- loads combat.lualocal helpers = require("utils.helpers") -- loads utils/helpers.luaStandard Lua require() semantics apply: modules are cached after the
first load, and should return a table of exports.
Data fields
Section titled “Data fields”rune.config_dir and rune.version are plain strings set by the
client. rune.config_dir reflects --config-dir, RUNE_CONFIG_DIR, or
the platform default, in that order. Set rune.debug to true to make
rune.dbg print messages with a [dbg] prefix. When it is false,
rune.dbg does nothing:
rune.debug = truerune.dbg("trigger fired for " .. name)Related: Scripting Basics · State & Lines · rune.alias · Storage