decompile
Reconstructs readable Luau source from compiled bytecode.
Reconstructs Luau source from the bytecode that backs a LuaSourceContainer, a Lua function, or a raw bytecode string.
The call yields the calling thread while the recovery runs; the returned string is Luau source that recompiles against the matching Luau version.
decompile(target: LuaSourceContainer | function | string): stringHow it works
Acedia ships a standalone helper that is spawned per call; it does not share a VM with the game and cannot execute what it reads.
You may invoke this standalone helper manually under %Appdata%\Acedia\Decompiler.exe <bytecode>
decompileextracts bytecode fromtarget:- A
LuaSourceContainer(LocalScript,ModuleScript,Script) is read through the engine's bytecode accessor. - A Lua function is serialized back to a bytecode chunk from its live proto.
- A string is passed through as-is after a minimum-length check.
- A
- The bytecode is decompiled.
decompileyields until the helper exits, then returns the source.
What is recovered
The helper lifts bytecode to an SSA form, rebuilds control flow, and emits a typed source AST. It currently reconstructs:
- Straight-line code, arithmetic, string and table operations.
- Constant table templates, nested calls, multireturn calls, and open result lists.
- Vector constants with a zero fourth lane as
Vector3.new(x, y, z). if/else, short-circuit guard chains, comparison chains, constant-comparison jumps, and nested branches that share an exit.- Numeric
for, genericfor,repeat … until(one or two exit tests), andwhileloops, includingbreakandcontinue. - Captured upvalues as either value captures or mutable cells, with stable local names reused across captures.
- Conservative constant folding and dead-branch removal where branches can be proven.
Unknown calls, property reads, mutable captured cells, loop-carried writes, and unproved predicates are left intact rather than guessed. Unsupported shapes raise an error instead of printing plausible-but-wrong source.
Supported bytecode
The helper reads serialized Luau bytecode versions 9–14.
Parameters
| Parameter | Type | Description |
|---|---|---|
target | LuaSourceContainer | function | string | A script instance, a Lua function with a reachable proto, or a non-empty binary bytecode chunk. |
Example
local function sample(value) return value + 1 end
local ok, source = pcall(decompile, sample)
if ok then
print(source)
else
warn(source)
endErrors
Raises if the input is a C function, empty, or not valid bytecode. Raises with the helper's diagnostic when the chunk uses a construct source reconstruction has not yet implemented, when the recovered source fails to recompile, or when the helper could not be found.
Report issues if something errors/has not been implmenented and we will work on it.
