Skip to content

isexecutorclosure

isexecutorclosure checks whether a given function is a closure of the executor. This also includes closures retrieved using getscriptclosure or loadstring

function isexecutorclosure(func: (...any) -> (...any)): boolean

Parameters

Parameter Description
func The function to check.

Example

Identifying executor closures with isexecutorclosure
local function dummy_lua_function()
    print("This is an executor Lua closure")
end

local dummy_cfunction = newcclosure(function()
    print("This is an executor C closure")
end)

local dummy_standard_cfunction = print
local dummy_global_cfunction = getgc

print(isexecutorclosure(dummy_lua_function)) -- Output: true
print(isexecutorclosure(dummy_cfunction)) -- Output: true
print(isexecutorclosure(dummy_global_cfunction)) -- Output: true
print(isexecutorclosure(dummy_standard_cfunction)) -- Output: false