How was it to send a function for as delegate as parameter?

Hello yuo guys answered me but I lost the post… Not in favs anymore any idea?
It was something like CatFunction( Function MyFunctionAsDelegate ) ?? I don’t remember.

Think of delegates like a format or a pattern for functions. A delegate says what kinds of parameters are in a function, and a return type if applicable, like this:

delegate NoParameterDelegate();
delegate IntInputDelegate(int x);
delegate StringInputDelegate(string s);
delegate int ReturnIntDelegate(int x);

Then you have functions that follow the pattern of those delegates:

function int ReturnIntFunction1(int x) // Follows pattern set by ReturnIntDelegate
{
    return x + 1;
}

function int ReturnIntFunction2(int x) // Follows pattern set by ReturnIntDelegate
{
    return x + 2;
}

Then you have a function that you can send a function as one of its arguments:

function DoSomethingWithAnotherFunction(delegate<ReturnIntDelegate> f, x)
{
    local int value;
    value = f(x);
    `log("Function returned " $ value);
}

And finally, you can call that function and send it different functions that follow the delegate’s pattern:

function foo()
{
   DoSomethingWithAnotherFunction(ReturnIntFunction1, 1); // "Function returned 2"
   DoSomethingWithAnotherFunction(ReturnIntFunction2, 1); // "Function returned 3"
}

Thank you lots, I did not find the post that you have sent me, it is to assign a function delegate to a custom button… long story.

Error this gives me error :cold_sweat: are you sure you have to put it in between<> ? I have something like function myfunctwithdeleparam( optional delegate ) and it gives error.