Luau VM: features and usage
Official Luau compiler/VM version 0.655, commit 2e6fdd90a0fd97832a1ce3da12636a0c44c10b45, has been added as an independent lua_State. References: Luau, official source.
Files
New Standard packages can include standalone-engine:
- PotassiumVM.exe: standalone Luau file runner or IPC host.
- Potassium.dll: engine DLL with the same VM.
- README.md and Luau/Lua licenses.
Original Roblox payload in bin is retained. An independent lua_State cannot replace a Roblox-specific runtime and gain game access. Do not copy the new DLL into bin as a Dex/bridge fix.
Supported execution
Luau compilation, bytecode loading, protected calls, standard libraries, print/warn, loadstring, identifyexecutor, getgenv. Supports Luau syntax, including type annotations and +=; this is not a renamed Lua 5.1 interpreter.
Each chunk has a sandboxed global environment. Share values explicitly through getgenv(); normal globals are not shared. That table lasts for the VM lifetime.
Compile/runtime/memory errors reach Console. “[ExtraExecutor VM] Standalone Luau chunk completed” refers only to ordinary chunk completion, not Roblox entry/game effects. Script-printed completed text is also not independent proof.
Not provided
Roblox game, workspace, Instance/services, Players.LocalPlayer, task, WebSocket.connect, HttpGet/request, Roblox userdata bindings/scheduler. Yield across native boundaries and background tasks are not implemented.
Dex, E2E-PROBE.luau, session bridge, and game bridge need a different compatible Roblox runtime. Studio plugin is a separate Studio API path. Compiler/VM availability does not automatically expose Roblox state.
Running a file
From standalone-engine:
PotassiumVM.exe your-script.luau
Example file:
local value: number = 2
value += 3
print(value)
local fn = assert(loadstring("return 6 * 7"))
print(fn())
This is a usage example, not a test report. Exit 0 means completed chunk, 1 compile/runtime error, 2 invalid arguments/file error. stdout/stderr are available in the terminal.
Editor/MCP connection
- Open ExtraExecutor.
- Run PotassiumVM.exe --ipc in a terminal.
- Host connects to local IPC port 8224; POTASSIUMWSPORT overrides it.
- Obtain actual PID via MCP listclients and pass it to executescript.
- print/warn/errors reach application Console; read_console reads the shared client log.
- Ctrl+C stops the host.
No Roblox attachment is needed. Do not configure Roblox account recovery for this host PID: it lacks Roblox services/session heartbeat. UI may use generic client labels; identify by actual PID.
Limits and lifecycle
- Source up to 1 MiB.
- Queue up to 32 chunks / 8 MiB.
- VM-managed allocations up to 128 MiB, not all process/compiler/C++ memory.
- Interrupt callback checks a 5-second deadline and Stop at VM interruption points; not forced Windows termination or a compilation timeout.
- Up to 200 print/warn messages / 64 KiB output per chunk; individual message up to 16 KiB. Excess is not forwarded.
- GC runs after completion. Shared getgenv retains explicit values; host restart resets them.
- VM has one worker thread; IPC queues code rather than executing concurrently.
DLL is pinned until process exit to prevent worker execution from an unloaded module. PotassiumStartRuntime / PotassiumStopRuntime allow start/stop outside DllMain. DllMain does not wait for the worker under loader lock. Hot unload is unsupported; end your host process.
Building
From the executor source root: scripts/build-luau-engine.ps1. Requires MSVC C++ x64 and CMake. No tests are run; Luau CLI/tests are disabled.
Without engine/vendor/luau, CMake fetches the exact commit from official GitHub. Prepare it locally for offline builds. Luau source is separate from our engine; checkout/build output is not committed. Licenses are packaged.
Status
DLL and host compiled. Chunks, IPC, time/memory limits, and Roblox compatibility were not tested in this pass at the user's earlier request. Full in-game end-to-end remains unfinished.