getscriptclosure
Loads a script container's bytecode as a callable closure.
Returns nil if the container cannot be loaded. Loading creates a closure and binds its script environment; it does not execute the script. Executing it yourself can repeat script side effects.
getscriptclosure(target: LuaSourceContainer): function?Parameters
| Parameter | Type | Description |
|---|---|---|
target | LuaSourceContainer | Container whose bytecode should be loaded. |
Example
local target = game:FindFirstChildWhichIsA("LocalScript", true)
if target then
local callback = getscriptclosure(target)
print(type(callback))
endExample output
functionAliases: getscriptfunction.
