getscriptbytecode.
Parameters
function
required
A Luau closure.
Returns
string
The function’s compiled bytecode.
Example
Errors
Related
getfunctionhash: hash a function instead.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Read a Luau function’s bytecode.
getfunctionbytecode(fn: function) -> string
getscriptbytecode.
local bc = getfunctionbytecode(function() return 1 end)
print(#bc)
| Message | Condition |
|---|---|
cannot read bytecode from a value that is not a function | Argument 1 was not a function. |
this function has no readable bytecode | The function exposed no bytecode. |
expected a Luau function, got a C closure | Argument 1 was a C closure. |
getfunctionhash: hash a function instead.