AcediaDocumentation

newcclosure

Wraps a function in an executor C closure.

Arguments and return values are forwarded. The native entry validates the optional name but does not pass it to the wrapper constructor; do not depend on it setting a debug name.

newcclosure(callback: function, name: string?): function

Parameters

ParameterTypeDescription
callbackfunctionFunction the wrapper forwards calls to.
namestring?Optional name argument accepted by the current interface.

Example

local wrapped = newcclosure(function(value) return value * 2 end)
print(wrapped(4), iscclosure(wrapped))

Example output

8	true

On this page