newcclosure

Wraps a function in a C closure.

Syntax

Signature
newcclosure(Function: function) -> function

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
FunctionfunctionFunction called by the wrapper.

Returns

TypeDescription
functionNew C closure recognized by isnewcclosure.

Notes

The wrapper forwards arguments, return values, yields, and errors on the calling coroutine. Function may be a Luau or C closure.

Example

Luau
local Result = newcclosure(function() return 42 end)
print(Result)