Set variable based on a string

Hello guys,

I don’t know the name of this concept, but is there a way to dynamically set a var named “X” (int) based on a string var “X”?

So if my string is “Armor” in object A, i want it to set the var “Armor” (int) in object B.
Without doing a switch of course because I can have more than 150 editable vars this way.

Thanks

The name is “type introspection”; the ability of a program to know about its own code.
A more broader term is “reflection”.

In the use case you describe, you should work with references, not only for performance reasons, but also for code sanity.

Have you considered using a Map?