run_lua
Execute Lua in Tabletop Simulator's global script context to manipulate game objects and return results as JSON-compatible values. Use return statements; userdata must be returned as fields.
Instructions
Execute Lua in the TTSim Global script context and return the result.
Use return to get a value back. Tables arrive as JSON objects/arrays; numbers, strings,
booleans and nil (null) work too. TTSim objects (userdata) cannot be returned directly:
return their fields instead, e.g. local o = getObjectFromGUID("abc123") return {name = o.getName(), pos = o.getPosition()}.
Lua runtime and syntax errors come back as tool errors with the TTSim message.
Changes made here are visible to the player immediately, so act deliberately.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |