I'm trying to create some
lazy macros. My scripting engine must be set up with pointers to variables and have an identification text version of that same variable. Like this..
Script->AddVariable(&MyInt, "MyInt");
Script->AddValue(ENUM_VALUE, "ENUM_VALUE");
As you can see, the names always match. Now imagine about 500 of these. It's ugly, and a maintenance nightmare. Actually, there are only a few of the AddVariable type lines, but many, many values.
Are there any ways I can cheat here? At least on the value versions? How can I give the scripting engine the value of an enum and it's text name all at once?
#define ADD_VALUE(_eval_) AddValue(_eval_,"_eval_");
It would be even cooler to go through a loop for the whole slew of enum values of each type, but I'm almost sure the IDE wouldn't allow such hacking.
for(int i=0; i<ENUM_MAX; i++)
AddValue( GetEnumValue(i), GetEnumLabel(i) );
The scripting engine is of my own creation, so feel free to offer any advice on how to avoid this situation to begin with.
Thanks for any advice.