Disassembler

disassemble

Disassembles a function into readable bytecode assembly.

Syntax

disassemble(callback: function, options?: DisassembleOptions): string

Arguments

NameTypeDescription
callbackfunctionFunction, stack level, or prototype to inspect.
options?DisassembleOptionsOptional settings table that controls how the operation behaves.

Returns

NameTypeDescription
assemblystringDisassembled bytecode text.

Description

Disassembles a function into readable bytecode assembly.

Call it with 2 parameter(s): callback, options. The argument table explains which values are required and which ones only refine the behavior.

It returns assembly (string). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Disassemble a callback with selected output options.

local assembly = disassemble(function(value)
    return value * 2
end, {
    Recursive = false,
    ShowLines = true,
    ShowConstants = true,
})

print(assembly)

Types

DisassembleOptions

Controls how Luau bytecode is rendered in the disassembly output.

Recursive? boolean Includes nested child prototypes in the output.ShowLines? boolean Shows source line numbers next to instructions when line data is available.ShowConstants? boolean Lists the constant table for each prototype.StringPreviewMax? integer Limits the number of characters shown when previewing string constants.