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.
Luau
newlclosure(callback: Function, name: string?) -> FunctionParameters
| Parameter | Type | Description |
|---|---|---|
callback | Function | The function to forward to; C and Luau functions are accepted. |
name | string? | Optional string accepted for compatibility; it does not set the returned closure’s name. |
Returns
FunctionA Luau closure that passes through arguments and return values.
Example
Luau
local forwarded = newlclosure(function(value) return value + 1 end)
print(islclosure(forwarded), forwarded(4)) -- true, 5