Dynamicly locating enum by using string?
#1

I remember asking this question like a long time ago, never really got an answer so figured I'm gonna try again and see if anybody got some helpful insight.

I'm trying to figure out a way to get enum data available using a string instead.

I'm not sure how to explain it so I'm gonna come with an example:
pawn Код:
/Normally you would do:
enum testenum{
Test1,
Test2,
Test3,
Test4
};
new enumTest[testenum];

// You would then do for example:
enumTest[Test1]
// To get that variables data.

// Now what I'm trying to do is:
new string[4];
string="Test2";
enumTest[string]
Reply
#2

You can't do that. enumTest is looking for an integer as its cell, not a set of characters. It would work if you did enumTest[string[0]], but it wont work with a whole string because its simply not an integer.
Reply
#3

Quote:
Originally Posted by king_hual
Посмотреть сообщение
You can't do that. enumTest is looking for an integer as its cell, not a set of characters. It would work if you did enumTest[string[0]], but it wont work with a whole string because its simply not an integer.
What about a way to like check a enum and its content and then find the integer for that enum variable you're looking for.

Edit: by content I mean, the variables, like locate their variables integer/row location.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)