getfunctionbytecode Synchronous

  • dumpbytecode

Serialize a Luau function’s compiled prototype to a byte string. Use this when a tool needs the actual compiled bytes rather than a readable source listing.

Syntax
Luau
getfunctionbytecode(value: Function) -> string

Parameters

Function parameters
ParameterTypeDescription
valueFunctionA Luau function. A C closure has no Luau bytecode to serialize.

Returns

string

A binary Luau bytecode string; it may contain zero bytes and is not source text.

Example

Example
Luau
local function square(value)
    return value * value
end
local bytecode = getfunctionbytecode(square)
print(#bytecode .. " compiled bytes")
Kawaii documentation