isnewcclosure
Checks if a function is a newcclosure wrapper.
Syntax
isnewcclosure(func: function) -> booleanAliases
iscustomcclosure
Parameters
| Parameter | Type | Description |
|---|---|---|
func | function | The function to check |
Returns
| Type | Description |
|---|---|
boolean | True if function was created by newcclosure |
Description
isnewcclosure checks whether a function was wrapped using newcclosure.
Example
local function luaFunc()
return "lua"
end
local wrapped = newcclosure(luaFunc)
print(isnewcclosure(luaFunc)) -- false
print(isnewcclosure(wrapped)) -- true
print(isnewcclosure(print)) -- false (native C closure)Notes
- Useful for distinguishing between native C closures and wrapped functions
- Returns false for native C closures like
print
Related Functions
newcclosure- Wrap as C closureiscclosure- Check if C closureislclosure- Check if Luau closure