NativeEvent:bind

From Wake
Jump to: navigation, search

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.

Function

Synopsis

NativeEvent:bind(func)
NativeEvent:bind(t, func)

Arguments

function func

The function to bind to the event.


table t

If specified, the function will have this table passed as its first argument.

Returns

None.


Example

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)

See Also