Lua Aliases
Run Lua when a typed command matches.
Lua aliases intercept manual input before simple aliases and variables. Scripts run in the same browser worker sandbox as advanced triggers.
Match Modes
exactmatches the full typed command.starts withmatches the beginning of the command and exposes the rest asmatches[2].containsmatches text anywhere in the command.regexenables JavaScript regular expressions and capture groups.
Example
Pattern: kt
Match: starts with
target = matches[2]
echo("<green>Target:<reset> " .. target)
send("kill " .. target)
Typing kt orc sets the PlayMUD.online variable target to orc, echoes colored feedback, and sends kill orc.
Actions
send("look")
send("look", 1) -- silent local echo
echo("<green>Green<reset> normal")
echo("<#12FA00>TrueColor<reset>")
Use Echo Colors for named colors and TrueColor tags. Echo output does not run triggers.
Variables
Global assignments write PlayMUD.online variables. They autosave with the current profile and can be used later as {target} in normal commands, aliases, hotkeys, and triggers.
target = "orc"
send("consider " .. target)
Use state.name for private Lua state that belongs only to that one alias.
Shared Helpers
Reusable functions belong in enabled Scripts. Lua aliases load enabled Scripts before running, so an alias can call functions such as luashow() directly.
-- Shared Script
function luashow(text)
echo("<cyan>" .. text .. "<reset>")
end
-- Lua Alias
luashow(matches[1])
Safety Limits
Lua aliases compile before they can be enabled. Runtime action limits are shared with Lua triggers and configured in web/src/modules/lua/config.js.