Volt

isnewcclosure

Checks if a function is a newcclosure wrapper.

Syntax

isnewcclosure(func: function) -> boolean

Aliases

  • iscustomcclosure

Parameters

ParameterTypeDescription
funcfunctionThe function to check

Returns

TypeDescription
booleanTrue 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

On this page