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.
Luau
getfunctionbytecode(value: Function) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
value | Function | A Luau function. A C closure has no Luau bytecode to serialize. |
Returns
stringA binary Luau bytecode string; it may contain zero bytes and is not source text.
Example
Luau
local function square(value)
return value * value
end
local bytecode = getfunctionbytecode(square)
print(#bytecode .. " compiled bytes")