Lysa  0.0
Lysa 3D Engine
EventManager Class Referenceabstract

Detailed Description

Publish/subscribe event bus used for engine and game events.

Lua full name: lysa.EventManager

Public Member Functions

nil fire (e: Event)
 Fires an event synchronously to all subscribers. More...
 
nil push (e: Event)
 Pushes an event to be fired at the start of the next frame. More...
 
integer subscribe (type: string, id: integer, cb: function)
 Subscribes to an event type with a resource id filter; returns a handler id. More...
 
integer subscribe (type: string, ids: integer[], cb: function)
 Subscribes to an event type with multiple resource id filters; a single unsubscribe() removes all. Returns a handler id. More...
 
integer subscribe (type: string, cb: function)
 Subscribes to an event type; returns a handler id. More...
 
nil unsubscribe (handler: integer)
 Unsubscribes from an event using the handler id returned by subscribe. More...
 

Member Function Documentation

nil fire ( Event  e)

Fires an event synchronously to all subscribers.

Parameters
eEvent
nil push ( Event  e)

Pushes an event to be fired at the start of the next frame.

Parameters
eEvent
integer subscribe ( string  type,
integer  id,
function  cb)

Subscribes to an event type with a resource id filter; returns a handler id.

Parameters
typestring
idinteger
cbfunction
Returns
integer
integer subscribe ( string  type,
integer[]  ids,
function  cb)

Subscribes to an event type with multiple resource id filters; a single unsubscribe() removes all. Returns a handler id.

Parameters
typestring
idsinteger[]
cbfunction
Returns
integer
integer subscribe ( string  type,
function  cb)

Subscribes to an event type; returns a handler id.

Parameters
typestring
cbfunction
Returns
integer
nil unsubscribe ( integer  handler)

Unsubscribes from an event using the handler id returned by subscribe.

Parameters
handlerinteger