Execute Luau
executeRun Luau scripts in the Opiumware Roblox client and get back return values, print/warn output, and error tracebacks.
Instructions
Run Luau in the Roblox client (Opiumware, thread identity 8) and get back return values, print/warn output, and errors with traceback.
Just
returnvalues; tables, Instances, Vector3s etc. are serialized automatically. Don't JSONEncode.Each run has its own global scope. Use getgenv() to keep state between runs. _G is the executor's; the game's is getrenv()._G.
Full executor API is available (getgc, hookmetamethod, decompile, firesignal, ...). To run a local file use the file parameter; the executor's own readfile/loadfile only see Opiumware's workspace folder.
Heavy scans (getgc, GetDescendants on large trees) must yield (task.wait() every few thousand items) or they freeze the game.
Long-running code (loops, listeners) should task.spawn and return right away. On timeout the run itself is cancelled, but threads it spawned keep running.
Errors returned here are NOT in the console. Errors/prints after the run returns (spawned/deferred code) only show in logs: use logs sinceExecute=true.
Separate execute calls made in parallel may run in any order.
Large results are saved to a temp file whose path is returned.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Luau source to run. Provide either code or file. | |
| file | No | Path to a local .lua/.luau file to run instead of code. | |
| port | No | Opiumware port of the Roblox instance (default: first found, see status). | |
| timeout | No | Seconds to wait for the result. |