Is there a way to pass <suspends> function as an input?

So I was just writing some delay functions like this:

(Function:tuple()->void).After(Time:float)<suspends>:void=
    Sleep(Time)
    Function()

(Function:t->void).After(Time:float,ExtraData:t where t:type)<suspends>:void=
    Sleep(Time)
    Function(ExtraData)

(Function:tuple(t,t)->void).After(Time:float,ExtraData1:t,ExtraData2:t where t:type)<suspends>:void=
    Sleep(Time)
    Function(ExtraData1,ExtraData2)

when I tried to pass suspends function as an input

(Function:tuple(t,t)<suspends>->void).Delay(Time:float,ExtraData1:t,ExtraData2:t where t:type)<suspends>:void=
    Sleep(Time)
    Function(ExtraData1,ExtraData2)

It didn’t work, I got: “Attributes are not allowed on invocation expressions.”

Is there some other way to do it?

This should work

(Function:type{_(:t)<suspends>:void}).After(Time: float, Args: t where t:type)<suspends>:void
1 Like

Thanks, I also tried with some api functions, but I got error when using parametric types.

(Function:type{_(:t)<transacts>:void}).After3(Time: float, Args: t where t:type)<suspends>:void=
    Sleep(Time)
    Function(Args)


spawn{WinnerFortCharacter.SetVulnerability.After3(7.6,true)}

Script error 3502: Using a value of type type{_(:type{_(:t)<transacts>:void},:tuple(float,t) where t)<suspends>:void} 
                  as a value of type type{_(:type{_(:logic)<transacts>:void},:tuple(float,logic))<suspends>:void} is not yet implemented.

I guess we can’t do much about it if it’s not implemented, this worked fine:

(Function:type{_(:logic)<transacts>:void}).After4(Time: float, Args:logic)<suspends>:void=
    Sleep(Time)
    Function(Args)

spawn{WinnerFortCharacter.SetVulnerability.After4(7.6,true)}
1 Like

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