Download

Anyway to use a foreach on the function return?

So if I have a function that returns an array of a certain class, I could do something like this:



local Actor _actor;
foreach MyFunctionThatReturnsAnArrayofActors()(_actor) {
    //do something with _actor;
}


This will return the compiler error:


Error, Cannot execute dynamic array iterator on the return value of a function

It seems kinda annoying that I have to assign a local variable to hold the return value, before being able to use iterators on it.

Wondering if there is some trick to get around this?

Not that I know of. Just make the local variable to hold the return value, man.