ES/addEvent
Jump to navigation
Jump to search
Syntaxis
bool addEvent ( string nombreEvento [, bool permitirtrigerremoto = false ] )
Argumentos Requeridos
- nombreEvento: El nombre del evento que deseas crear
Optional Arguments
- permitirtrigerremoto: Un boolean determinando si puedes trigear el evento remotamente.
Returns
Devuelve true si el evento fue agregado exitosamente, false si el evento ya esta agregado.
Example
This example will define a new event called onSpecialEvent.
-- Add a new event called onSpecialEvent addEvent ( "onSpecialEvent", true ) -- Define our handler function, that takes a "text" parameter and outputs it to the chatbox function specialEventHandler ( text ) outputChatBox ( text ) end -- Add it as a handler for our event addEventHandler ( "onSpecialEvent", getRootElement(), specialEventHandler )
You can then trigger this event later on using:
triggerEvent ( "onSpecialEvent", getRootElement(), "test" )
This will cause the handler to be triggered, so "test" will be output to the chatbox.