gre.add event listener

gre.add_event_listener(
    event,
    target,
    callback
)

Add an event listener that will invoke a callback with the standard mapargs table as its first argument. The target option can be used to specify a model object to listen on, if it is not present the listener will be created at the application level.

Parameters: event The string name of the event to listen for target An optional parameter containing the fully qualified name of a model object to listen on callback A lua function that is invoked with mapargs as its first argument when the event fires Return: An integer that identifies the created listener or nil on failure. The identifier is required to remove the listener. Example:

-- Register a listener to log gre.press X coordinates on a layer to console
gre.add_event_listener("gre.press", "Layer", function(mapargs) gre.log(-1, "X: "..tostring(mapargs.context_event_data.x)) end)
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.