Unbind a function from an event. The function (and table, if specified) must be the same exact instance as was bound initially, or else this function will do nothing. Having the same exact implementation in a function is not enough for unbind to work.
NativeEvent:unbind(func) NativeEvent:unbind(t, func)
- The function to unbind from the event.
- The table initially specified to NativeEvent:bind.
The following will print i each tick, until i reaches 100.
local i = 1 local function onTick() print(i) i = i + 1 if i >= 100 then engine.tick:unbind(onTick) end end engine.tick:bind(onTick)