Referencing to Enums

KorbohneD

Member
Quick Question Guys.

In my current project I have written a text file translator that turns text file code into real code.

Now the problem is, in the program, I have a bunch of enums, one in particular describing material. And of course I want to tell the textfile, which material it should give to the translator.
Is there any way to translate a string into an enum code?

Like I have this code here:

Code:
enum material {
   stone;
   wood;
   iron
}
textfile_variable = stone;

material_to_use = material.textfile_variable
Something like above?
I am really clueless what to do.
Any help is appreciated.

Sincerely,
KorbohneD
 

Taddio

Member
Not quite sure I got what you want exactly, correct me if I didn't understood correctly
Do you want
Code:
enum material {
   stone,
   wood,
   iron,
}
textfile_variable.material = stone;
?

Like I said, not so sure what you were asking, let me know if that's not it, I'll see what I can do
 

KorbohneD

Member
Not quite sure I got what you want exactly, correct me if I didn't understood correctly
Do you want
Code:
enum material {
   stone,
   wood,
   iron,
}
textfile_variable.material = stone;
?

Like I said, not so sure what you were asking, let me know if that's not it, I'll see what I can do

That code you posted doesn't make any more sense.
I have a text file, where I state an enum.
And I need that statement translated, so I can reference a real enum that I have in my code.
 

Taddio

Member
Why not simply create an unused script and state your enums in there (they will be inittialized even if no one calls the script, neat feature) instead of going through the hassle of dealing with external files?
 
Top