ReferenceClosures

isexecutorclosure

Checks whether a function was created by your code or by Apex, rather than by the game.

Syntax

isexecutorclosure(func: function) -> boolean

Also available as

checkclosureisexecutorfunctionisourclosurecheck_closureis_executor_closureis_our_closure

Parameters

ParameterTypeDescription
funcfunctionThe function to check.

Returns

TypeDescription
booleantrue when the function belongs to Apex or to code you ran, false when it belongs to the game.

Description

Luau functions count as yours when they were compiled from code you ran, including code loaded with loadstring. C functions count as yours when Apex provides them, such as hookfunction itself or a wrapper from newcclosure. Game functions and engine built-ins return false.

Example

print(isexecutorclosure(isexecutorclosure))
print(isexecutorclosure(function() end))
print(isexecutorclosure(print))
print(isexecutorclosure(loadstring("return 1")))

Notes

These are Game executor contracts. Check build requirements and session lifetimes before using them.