Bind a function to an event. Multiple functions can be bound to a single event, with them being called in order of binding when the event is called.
NativeEvent:bind(func) NativeEvent:bind(t, func)
- The function to bind to the event.
- If specified, the function will have this table passed as its first argument.
The following code increments and prints out the value of i every tick.
local i = 1 local function onTick() print(i) i = i + 1 end engine.tick:bind(onTick)