Closures

newlclosure

Creates an executor-owned Luau closure from a function.

Syntax

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

Arguments

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

Returns

NameTypeDescription
closurefunctionCreated closure function.

Description

Creates an executor-owned Luau closure from a function.

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 = newlclosure(function() end, "example")
print(result)