AcediaDocumentation

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): string

How 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>

  1. decompile extracts bytecode from target:
    • 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.
  2. The bytecode is decompiled.
  3. decompile yields 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, generic for, repeat … until (one or two exit tests), and while loops, including break and continue.
  • 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

ParameterTypeDescription
targetLuaSourceContainer | function | stringA 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)
end

Errors

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.

On this page