newlclosure Synchronous

Create a Luau forwarding closure around another function. Use it when you need a distinct Luau callable while keeping the original function’s behavior.

Syntax
Luau
newlclosure(callback: Function, name: string?) -> Function

Parameters

Function parameters
ParameterTypeDescription
callbackFunctionThe function to forward to; C and Luau functions are accepted.
namestring?Optional string accepted for compatibility; it does not set the returned closure’s name.

Returns

Function

A Luau closure that passes through arguments and return values.

Example

Example
Luau
local forwarded = newlclosure(function(value) return value + 1 end)
print(islclosure(forwarded), forwarded(4)) -- true, 5
Kawaii documentation