Storage & Worlds
Rune gives state three lifetimes. Pick by how long it should live:
| Lives until | Values | |
|---|---|---|
| Lua variables | /reload |
anything |
rune.session |
client exit | strings |
rune.store |
forever (store.json on disk) |
strings, numbers, booleans, tables |
Session store
Section titled “Session store”Survives /reload (the Lua VM is rebuilt) but not exit. Use it for
mid-session state you don’t want a reload to wipe:
rune.session.set("kills", tostring(kills))kills = tonumber(rune.session.get("kills") or "0")Values are strings only; encode anything richer yourself.
rune.session.delete(key) removes one.
Durable store
Section titled “Durable store”Backed by ~/.config/rune/store.json, which is pretty-printed,
hand-editable, and written atomically on every set. Takes structured
values:
rune.store.set("prefs", { autoloot = true, greet = "Hail, %s!" })local prefs = rune.store.get("prefs") or {}rune.store.set(key, nil) (or rune.store.delete(key)) removes a key.
Worlds
Section titled “Worlds”Named bookmarks, stored durably under the "worlds" key:
/world add viking vikingmud.org 2001/world add secure mud.example.com 4000 tls/worldsThen /connect viking, rune viking from your shell, or bare /connect
for a picker. From Lua:
rune.world.add(name, address, opts?) -- extra opts keys stored verbatimrune.world.get(name) -- { address = ... }rune.world.list()rune.world.remove(name)The opts table is yours: the auto-login recipe
stores a character name per world and reads it back on connect.
Gotchas
Section titled “Gotchas”- Unstorable values (functions, cycles, mixed-key tables) return
nil, errinstead of writing — check the return when storing anything built at runtime. - A corrupt
store.jsonis preserved asstore.json.bakat boot and reported, never silently discarded. store.jsonis plaintext on disk, so keep passwords out of it. The auto-login recipe shows alternatives.
Related: Storage reference,
Slash command reference
for the full /world and /connect forms