getfunctionbytecode
Returns bytecode for a single function.
Syntax
getfunctionbytecode(func: function) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
func | function | A Luau function. |
Returns
| Type | Description |
|---|---|
string | Bytecode for this one function and the functions nested inside it. |
Description
The result is a standalone bytecode chunk containing func as its main function, with its constants and the functions it defines. You can load it again or pass it to decompile.
Example
local function area(w, h)
return w * h
end
print(#getfunctionbytecode(area))
Notes
- C functions raise an error. So do functions whose upvalues refer to values outside the function, because those values cannot be stored in bytecode.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
