Pass functions by "reference" to bis event handlers (#4898)

* Pass functions by "reference" to bis event handlers

* Add Doc

* Fix
This commit is contained in:
PabstMirror
2017-02-14 10:54:37 -06:00
committed by GitHub
parent 036bb0ecd4
commit dfca4fdcf8
6 changed files with 16 additions and 7 deletions

View File

@ -590,6 +590,15 @@ Event handlers in ACE3 are implemented through the CBA event system (ACE3's own
More information on the [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} and [CBA Player Events](https://github.com/CBATeam/CBA_A3/wiki/Player-Events){:target="_blank"} pages.
<div class="panel info">
<h5>Warning about BIS event handlers:</h5>
<p>BIS's event handlers (`addEventHandler`, `addMissionEventHandler`) are slow when passing a large code variable. Use a short code block that calls the function you want.</p>
```js
player addEventHandler ["Fired", FUNC(handleFired)]; // bad
player addEventHandler ["Fired", {call FUNC(handleFired)}]; // good
```
</div>
### 7.4 Hashes
When a key value pair is required, make use of the hash implementation from ACE3.