Parameters
Returns
LuaSourceContainer? - The LocalScript or ModuleScript that created the closure, or nil if the closure is a C function or has no associated script.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
getscriptfromclosure(func: function): LuaSourceContainer?
| Parameter | Type | Description |
|---|---|---|
func | function | The closure function to check. |
LuaSourceContainer? - The LocalScript or ModuleScript that created the closure, or nil if the closure is a C function or has no associated script.
local script = getscriptfromclosure(print)
-- Determine if a function belongs to a game script
local function check_closure(func)
local s = getscriptfromclosure(func)
if s then
print("Function defined in: " .. s.Name)
else
print("Native or untracked function")
end
end