ExecuteFunc

Parameters
funcName string
bug

ExecuteFunc does not seem to release the trigger it spawns.

comment

Tries to find a function with the given name and calls it in a new thread.

note

Performance numbers:

  • 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).

note

As ExecuteFunc will run the target function in a trigger action context one way or another, TriggerSleepAction can be used.

note

If this is called in a trigger action context, ExecuteFunc will use that trigger, so GetTriggeringTrigger will return it. If ExecuteFunc is called in another type of context, it will spawn a new trigger, which can be seen with GetTriggeringTrigger.

return type
nothing
Source code
native ExecuteFunc          takes string funcName returns nothing
Source
trigger.j
wc3modding.com
ExecuteFunc