How to use/select a struct variable if you have its name in form of a String?

Hi all,
Sounds like a really simple question - hopefully there’s a simple answer as well:

I have a number of custom made Struct variables in my GameState Blueprint.
I also have a DataTable, containing a list of Strings that have the names of those Struct Variables.

How do I link between Strings and the names of those Structs?

Example:
I’ve got Structs named: Card1, Card2, Card3, Card4… (Each containing lots of stuff like textures, values, objects…)
And the Data Table spits out “Card3” in form of a String. How would I use the correct Struct according to what the Data Table outputs? Is there something like a String To Struct conversion? Or a Select Struct based on String?

Thanks a lot!
J

You cant

IF your structs has same type - you can organize it into array like:

TMap<FString, MyStructType> GlobalStructs;

GlobalStructs.Add("Card1", MyStructType(...));
GlobalStructs.Add("Card2", MyStructType(...));
GlobalStructs.Add("Card3", MyStructType(...));

GlobalStructs["Card2"].SomeSubVar = 5;

I think I get what you said…
But I’m looking for a BluePrint solution :slight_smile: (I’m not a real programmer)

I will order my structs into an array - the problem is that the order depends on what name is called by the string variable. (That’s the one I get out of my DataTable.)

A good solution would be making the structs themselves or their textures and objects part of the source data table as well… but that’s impossible / crashes / is unstable. So I only get a String with a name out of my DT.

Thanks Detech!

HI

Have you tried running a Loop and a branch off the String you want.