Developer console
Press F1 (or the backquote key, F3 or F12) in the game to show the developer tools bar, then press Console. Type /help for every command.
The bar's Mods menu has Reload mods, Open mods folder and the Script editor, where you edit, run and debug mods in the game.
Mod commands
| Command | Who | Does |
|---|---|---|
/mods | everyone | Lists installed mods, their versions, where they came from and their state |
/mods.log [id] [count] | everyone | Shows recent mod log lines, for all mods or one |
/mods.stats | everyone | Time each running mod spends per frame, its slowest call, calls and errors |
/mods.docs | everyone | Writes the API reference (api.json, api.md, theonaris.d.lua) to the game's data folder |
/mods.reload [id] | admins | Reloads one mod, or rescans the folder and reloads everything |
/mods.enable <id>, /mods.disable <id> | admins | Turns a mod on or off |
/lua <id> <code> | host | Runs Lua inside a running mod |
/tools scripts | everyone | Opens the script editor |
Reloading is refused while other players are connected, because every player must run the same mods. Turning a mod on or off during a session takes effect when the session ends. Enabling a mod from the console never skips the permission prompt: a mod that needs consent waits for you in Mods.
Running Lua inside a mod
/lua yourname.my-mod players.count()
/lua yourname.my-mod world.me()
/lua yourname.my-mod counter = 0
/lua yourname.my-mod storage.keys()The code runs inside that mod, with its globals, its permissions and its time budget. It is a way to poke at your mod while it runs, not a way around the sandbox. Expressions print their value, tables show their first entries, and errors show the file and line. Only the host can use /lua.
The script editor's Console does the same with more room: several lines at once, a history, and a choice of the client or the server copy of the mod.
Your own commands
With the devtools permission, a mod can add console commands:
devtools.command({ name = "spawn-ring", description = "Put a ring of spheres around you", level = "admin" }, function(args)
local count = tonumber(args[1]) or 8
spawnRing(count)
end)The command is typed as /<last part of your mod id>.<name>: yourname.rings gives /rings.spawn-ring 12. args holds the words after the command as strings. level is client (anyone), admin or host. Commands disappear when the mod stops.
A command added by a server script runs on the server: the console forwards it there, and the server checks the level. A command added by a client script runs on the machine where it was typed. On a host, where both copies of a mod run, the server's command wins.