Returns the compiled bytecode of a Luau function. Only Luau closures carry bytecode, so C closures are rejected. This is the function-level counterpart to getscriptbytecode.

Parameters

function
required
A Luau closure.

Returns

string
The function’s compiled bytecode.

Example

Errors