getscriptclosure
Closure is compiled from the script's bytecode, not an active one
The function returned by getscriptclosure
is a new closure compiled from the script's bytecode. It is not the function used by the game script, but has identical metadata. This function is usually used to retrieve constants from a script.
Not all scripts have bytecode
If the script has no compiled bytecode, this function will return nil
.
getscriptclosure
creates and returns a Lua function closure from the compiled bytecode of a Script
, LocalScript
, or ModuleScript
.
This function is often used to extract constants or behaviour from scripts without needing to run them inside the game.
Parameters
Parameter | Description |
---|---|
script |
The script instance to convert into a function. |