Run Lua inside grandMA3
gma3_luaEvaluate Lua 5.4 code inside grandMA3's Lua engine and return results as JSON, enabling scripted queries and control through its API.
Instructions
Evaluate Lua 5.4 code inside the grandMA3 Lua engine and return the result(s) as JSON. The code is first compiled as an expression ('return '), then as a statement block. All grandMA3 Lua API functions are available (Cmd, ObjectList, DataPool, Root, ShowData, Patch, Programmer, SelectedSequence, GetCurrentCue, GetExecutor, GetVar/SetVar, Printf, Echo, Enums, ...). Object handles are returned as {name, class, addr, addrNative, index, childCount}; use handle:Get('Prop') to read properties, :Children(), :Count(), :Ptr(i). Examples: 'SelectedSequence().name', 'GetCurrentCue():Get("No")', 'DataPool().Sequences:Count()', 'local t={} for i,c in ipairs(ObjectList("Fixture Thru")) do t[#t+1]=c.name end return t'. Use gma3_lua_api to look up function signatures. This capability is OFF by default on the console: the operator enables it by starting the bridge with Plugin "gma3_mcp_bridge" "lua" or running Plugin "gma3_mcp_bridge" "lua on" (gma3_status shows the policy). Each request runs under the console's execution budget (default 5 s wall-clock / 20 M VM instructions, operator-configurable) and is aborted with an error when it exceeds it, so keep scripts short and prefer the structured tools (gma3_get_object, gma3_list_children, gma3_objects) for bulk reads. By default the console's own hook on the plugin thread is preserved, which means the instruction budget is NOT enforced and the deadline is only checked when the script yields or returns: a script that loops without yielding cannot be stopped (gma3_status shows lua.bounded; the result's budget.instructionHookEnforced says what applied). The operator can start the bridge with luahook=replace to enforce hard quotas. Because a script may call Cmd() or Set(), every gma3_lua request is serialised with this server's other mutations (it waits for a running workflow and blocks later ones while it runs).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Lua code to evaluate | |
| timeout_ms | No | Request timeout (default 15000). Also passed to the console as the wall-clock execution budget, capped by the console's own limit, so the code stops when the client stops waiting. |