/lua¶
Syntax¶
/lua run <name> [args]
/lua stop <name|all>
/lua restart [name|all]
/lua list
Description¶
Start, stop, restart, and list Lua scripts. This is the entry point for everything in clockwork's scripting layer.
Options¶
- run <name> [args] — Start the script
<name>. Everything after the name is passed to the script verbatim as its argument string. Refuses if the script is already running — stop it first, or userestart. - stop <name|all> — Stop one script by name, or
allto stop every running script. - restart [name|all] — Stop and start again, reusing the args the script was
originally started with. With no name, restarts everything currently
running — the usual move after editing a shared module under
lua/lib/. - list — Print the number of running scripts and their names.
/lua reload is accepted as an alias for /lua restart. It affects scripts
only — nothing about it touches eq2core.dll.
Where scripts live¶
/lua run <name> resolves <name> against exactly two paths:
| Path | For |
|---|---|
lua/<name>.lua |
A single-file script. |
lua/<name>/init.lua |
A multi-file script. |
The flat file wins if both exist.
Examples¶
/lua run hello
/lua run travel Antonica
/lua run gyonin
/lua list
/lua stop hello
/lua restart
/lua stop all
Lifetime and cleanup¶
Each script runs as its own LuaJIT coroutine, resumed once per game pulse.
When a script stops — whether via /lua stop, a restart, or by returning from
its main chunk — clockwork sweeps everything it registered:
- Commands registered with
eq2.register_command()are unregistered. - Event tokens from every
eq2.on_*subscription are released. - ImGui windows registered with
eq2.imgui.init()are destroyed.
You do not need to unregister anything by hand on the normal shutdown path.
Scripts that provide a command must keep running
A script that registers a command and then falls off the end of its main
chunk immediately unregisters that command. Scripts like inv_helper and
nav sit in a while true do ... eq2.delay(...) end loop for exactly this
reason. Stop them with /lua stop <name> when you're done.
The 500 ms watchdog¶
A single coroutine resume that runs longer than 500 ms without yielding is
killed on the assumption that it's an infinite loop. Yield with eq2.delay(ms)
inside every loop.