Skip to content

func

Type

Function type and anonymous callback prefix. Callbacks, listeners, pcall bodies.

func name = value;

None.

A value of type func, emitted as (...any) -> any.

(...any) -> any

There are no C++ captures. Write func (int n) { } or assign func cb = func () {};.

func onCoinsChanged = func (int newValue) {
post("New value: " .: newValue);
};

Emits:

local onCoinsChanged: (...any) -> any = function(newValue: number)
print("New value: " .. newValue)
end

lambda · function · Connect