11# Scraped from: https://wiki.multitheftauto.com/wiki/AddEventHandler
22shared :
33 name : addEventHandler
4- description : This function will add an [event](/wiki/Event "Event") handler. An
4+ description : This function will add an [event](/reference/Event_System "Event System ") handler. An
55 event handler is a function that will be called when the event it's attached to
6- is triggered. See [event system](/wiki/Event_system "Event system ") for more information
6+ is triggered. See [event system](/reference/Event_System "Event System ") for more information
77 on how the event system works.
88 parameters :
99 - name : eventName
1010 type : string
11- description : ' The name of the event you want to attach the handler function to.
12- Note: The maximum allowed length is 100 ASCII characters (that is, English letters
13- and numerals)'
11+ description : ' The name of the [ event](/reference/Event_System "Event System") you want to attach the handler function to.
12+ ** Note: The maximum allowed length is 100 ASCII characters (that is, English letters
13+ and numerals)** '
1414 - name : attachedTo
1515 type : element
16- description : The element you wish to attach the handler to. The handler will only
16+ description : The [ element](/reference/Element "Element") you wish to attach the handler to. The handler will only
1717 be called when the event it is attached to is triggered for this element, or
1818 one of its children. Often, this can be the root element (meaning the handler
19- will be called when the event is triggered for any element).
19+ will be called when the event is triggered for * any* element).
2020 - name : handlerFunction
2121 type : function
2222 description : The handler function you wish to call when the event is triggered.
@@ -25,14 +25,19 @@ shared:
2525 - name : propagate
2626 type : bool
2727 description : A boolean representing whether the handler will be triggered if the
28- event was propagated down or up the element tree (starting from the source),
28+ event was propagated down or up the [ element tree](/reference/Element_tree "Element tree") (starting from the source),
2929 and not triggered directly on attachedTo (that is, handlers attached with this
3030 argument set to false will only be triggered if source == this ). In GUI events
3131 you will probably want to set this to false .
3232 default : ' true'
3333 - name : priority
3434 type : string
35- description : MISSING_PARAM_DESC
35+ description : |
36+ A string representing the trigger order priority relative to other event handlers of the same name. Possible values are:
37+
38+ "high"
39+ "normal"
40+ "low"
3641 default : ' "normal"'
3742 examples :
3843 - path : examples/addEventHandler-1.lua
@@ -52,15 +57,15 @@ shared:
5257 On the same note, for multiple reasons, it isn't a good idea to export the same
5358 functions that you use locally as remote event handlers.
5459 - type : info
55- content : See Event Source Element for a descriptive visualization of the event
60+ content : See [ Event Source Element](/reference/Event_Source_Element "Event Source Element") for a descriptive visualization of the event
5661 system handling an event trigger.
5762 - type : important
58- content : See Script security for how-to prevent cheaters from abusing event system
59- and element data .
63+ content : See [ Script security](/Script_security "Script security") for how-to prevent cheaters from abusing [ event system](/reference/Event_System "Event system")
64+ and [ element data](/reference/Element_data "Element data") .
6065 - type : important
6166 content : Anything bound to a specific element will be run before other handlers
6267 that are bound to something higher in the element tree (like root) This means
63- that "high+10" bound to root won't trigger before "normal" bound directly to
68+ that "high+10" bound to root ** won't** trigger before "normal" bound directly to
6469 an element.
6570 - type : info
6671 content : Due to the additional set of global variables, the event-trigger specific
@@ -73,4 +78,3 @@ shared:
7378 the same issues. It is recommended to adapt a good-natured distancing principle
7479 between code meant to run from local logic in separation to code meant to run
7580 from remote logic.
76- requires_review : true
0 commit comments