getfunctionbytecode

Returns the bytecode for a Luau closure.

Syntax

getfunctionbytecode(func: function) -> string

Parameters

ParameterTypeDescription
funcfunctionLuau closure to read

Returns

TypeDescription
stringBinary Luau bytecode for the closure

Example

local function add(a, b)
    return a + b
end

local bytecode = getfunctionbytecode(add)
print(type(bytecode), #bytecode > 0) -- string, true

Notes

  • C closures are rejected