How to pass a function (not a result) as a member of an array

DebugFunc():void=
        var TestArr : []void = array{}
        set TestArr += array{DebugFunc2}
        for (FuncToProcess : TestArr):
            FuncToProcess
DebugFunc2():void=
        Print("2")

So this compiles but crashes the UEFN session. If I add “()” in “array{DebugFunc2}” then it won’t crash, but I will get “Print(“2”)” immediately, but I want to delay the result until the for loop starts going through. I don’t know if it’s even possible, so any help will be appreciated.

DebugFunc():void=
    # var TestArr : []void = array{}
    var TestArr : [](tuple() -> void) = array{}
    set TestArr += array{DebugFunc2}
    for (FuncToProcess : TestArr):
        # FuncToProcess
        FuncToProcess()
DebugFunc2():void=
    Print("2")
1 Like

thanks youre the goat bro

1 Like

To add onto what LAMA posted if you need to specify a method that has an effect you can use this syntax

i personally like to replace the ‘_’ with ‘func’

so

type{func(:param1, :param2)<effect_here>:void}
DebugFunc():void=
    var TestArr : []type{_()<transacts><decides>:void} = array{}
    set TestArr = TestArr + array{DebugFunc2}
    for(Func:TestArr):
        if(Func[]):

DebugFunc2()<transacts><decides>:void={1 = 1}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.