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

    Parameters

    • funcName: string

    Returns void

    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.

    Bug

    ExecuteFunc does not seem to release the trigger it spawns.

    Note

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

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

Generated using TypeDoc