decompile Asynchronous

  • bytecode_to_lua

Translate Luau bytecode or a script Instance into readable source-like text. Use it to inspect code when the original source is unavailable; the output is a reconstruction, not the author’s exact file.

Syntax
Luau
decompile(input: string | ScriptInstance, options: DecompileOptions?) -> string

Parameters

Function parameters
ParameterTypeDescription
inputstring | ScriptInstanceA Luau bytecode string or script Instance with readable stored bytecode.
optionsDecompileOptions?Optional target and mode fields. target is luau or lua51; mode is decompile or disasm.

Argument fields

DecompileOptions fields
Luau
DecompileOptions = {target: ("luau" | "lua51")?, mode: ("decompile" | "disasm")?}

Returns

string

Text produced by the decompiler or disassembler.

Usage notes

The call can yield while native work completes. Invalid bytecode, unsupported options, or an unavailable script body raises an error.

Example

Example
Luau
local candidate = getscripts()[1]
if candidate then
    local ok, source = pcall(decompile, candidate, { target = "luau" })
    print(ok and source:sub(1, 200) or "Decompilation unavailable")
end
Kawaii documentation