Event handler

From TargetWiki

Event handlers are used in several places in the Targetware Lua API. Each event handler can have an arbitrary number of Lua functions assigned to it. When an event occurs, each of those functions is called, in non-determinant sequence, with arguments that depend on the nature of the event.

Since event handlers are objects, they should be called using the object:function() Lua syntax. The functions available on an event handler object are:

add( <function> )
The argument is a Lua function which will be added to the list of functions called when this event handler fires.
remove( <function> )
This removes the specified Lua function from the event handler's list.
Views