Skip to content
Saiko

getscriptclosure

Returns a fresh closure of a script's body without running it, which lets you inspect its constants and upvalues.

Signature

luau
getscriptclosure(script: BaseScript): (...any) -> ...any

Parameters

scriptLocalScript | ModuleScript

The script to wrap.

Returns

function

Example

luau
local module = game:GetService("ReplicatedStorage").Config
local closure = getscriptclosure(module)
print(closure()) -- the table the module returns, without requiring it