Download

How do i get only 1 out parameter out of 9?

guys I’ve got an interface function call here which returns 9 parameters but I only need the very last parameter and not all of them. is it possible to get only the one I need?

basically this…
i just need the last parameter not all of them
Annotation 2021-10-14 133859

Your two best options here are a) for GetCharacterCurrentStats to return a structure with all that information which you could then access as Struct.OverlayState or b) make 9 different functions which each return exactly one of those values and then you only make the calls to get the exact values you want.

Personally, I’d recommend option b.

none of those options would work cuz this function has been used in so many other places.

anyway this is what I ended up doing, I created some dummy variables just to fill up the arguments. hopefully it doesn’t affect performance.

Eh, if you change it the compiler will tell you all the places that you need to fix. It may be annoying and tedious but the outcome is better code. Alternatively you could write the single accessor that you need right now and use it (and use it directly in other places) or write all 9 accessors without removing GetCharacterCurrentStats so that you don’t have to change any of those other places. In that case I would recommend GetCharacterCurrentStats just calling the 9 accessors that you just wrote.

one more question unrelated to the topic… how do I loop through an enum based on its length? in bp it’s easy there are premade functions to do this but in c++ it looks like it requires more work and so far this is what I ended up getting:

first I use the EnumRange By count macro to do something which I don’t understand lol
Annotation 2021-10-15 031538

then I use the TEnumRange to make it loopable I guess?
Annotation 2021-10-15 031514

is this really the right way to do this? i cant belive there are no premade function to loop through an enum and it needs to be done manually.

The C++ language doesn’t really have anything premade for you. You don’t even get a real string without going to the Standard Library.

It looks like that would work, I hadn’t seen that functionality from the engine before so that’s sort of cool but I don’t know when I’d ever use it. If I have to do a loop over an enum usually designed for that purpose and I can do:

for (int x = 0; x < Enum::Max; ++x)
{
     Enum e = (Enum)x;
     ...
}

but even then it’s probably because it’s designed as an array index or something. So I’m really just looping over the array size and not the enumeration.

I would never considering looping over an enumeration with non-consecutive values. Or worse still, bitflags.