ExecuteFuncdoes not seem to release the trigger it spawns.
Tries to find a function with the given name and calls it in a new thread.
- 10000 regular function calls in Jass: 3ms (300ns/call)
- 10000 regular function calls in Lua: 0.07ms (6.9ns/call)
- 10000 "ExecuteFunc" calls in Jass: ~50ms (5µs/call)
Result: plain Lua is ~43.5x and ~724x faster respectively.
Source: Unryze's test results using this code and his UjAPI (Jass on 1.26a; Lua on 1.32.10 and 1.26a).
ExecuteFuncwill run the target function in a trigger action context one way or another,
TriggerSleepActioncan be used.
If this is called in a trigger action context,
ExecuteFuncwill use that trigger, so
GetTriggeringTriggerwill return it. If
ExecuteFuncis called in another type of context, it will spawn a new trigger, which can be seen with
- return type
- Source code
native ExecuteFunc takes string funcName returns nothing