AcediaDocumentation

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

ParameterTypeDescription
targetLuaSourceContainerContainer whose bytecode should be loaded.

Example

local target = game:FindFirstChildWhichIsA("LocalScript", true)
if target then
    local callback = getscriptclosure(target)
    print(type(callback))
end

Example output

function

Aliases: getscriptfunction.

On this page