Closures

iscclosure

Returns whether the provided function is a C closure.

Syntax

iscclosure(func: function): boolean

Arguments

NameTypeDescription
funcfunctionFunction value passed to C closure check.

Returns

NameTypeDescription
isCClosurebooleantrue when C closure check returns true for the function; otherwise false.

Description

Returns whether the provided function is a C closure. The argument must be a function; passing any other type raises a type error. The function does not inspect executor ownership, source, bytecode, or upvalues.

Call it with 1 parameter(s): func. The argument table explains which values are required and which ones only refine the behavior.

It returns isCClosure (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Check whether a function is a C closure.

local result = iscclosure(print)
print(result)