lua_exec
Execute Lua code on the Factorio server to query game state or perform custom actions. Use 'return' to capture results.
Instructions
Execute Lua code on the Factorio server via /silent-command. The code is wrapped in a function — use 'return' to send results back. Results are serialized via serpent.line for tables. Use this for any game state query not covered by specific tools.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "lua_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Lua code to execute. Use 'return expr' to get a value back. Tables are auto-serialized. |