Syntax
isnewcclosure(func: function): booleanArguments
| Name | Type | Description |
|---|---|---|
func | function | Function to check. Use a single function argument. |
Returns
| Name | Type | Description |
|---|---|---|
isNewCClosure | boolean | true when the function is a newcclosure-created C closure; otherwise false. |
Description
Returns whether the provided function is a newcclosure-created C closure. The first argument must be a function; passing a non-function raises a type error. Documented usage is a single function argument; extra arguments are not part of the supported signature.
Call it with 1 parameter(s): func. The argument table explains which values are required and which ones only refine the behavior.
It returns isNewCClosure (boolean). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Check whether a function is a wrapped C closure.
local function target()
end
local wrapped = newcclosure(target)
print(isnewcclosure(target))
print(isnewcclosure(wrapped))