Closures

newcclosure

Wraps a Luau function as an executor-created C closure.

Syntax

newcclosure(func: function, debugName?: string): function

Arguments

NameTypeDescription
funcfunctionFunction to wrap as a C closure.
debugName?stringOptional debug name assigned to the created closure.

Returns

NameTypeDescription
closurefunctionCreated closure function.

Description

Wraps a Luau function as an executor-created C closure.

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

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

Example

Example call with placeholder values.

local result = newcclosure(function() end, "example")
print(result)