tiagolapa
Member
|
Convert int to code editor Enum
Hello
I can't figure out how to convert a int value to custom Enum created in code editor.
I tried using Enum class, but can't find a way to do it.
I can print enums names using the next code:
Code:
Enum *event_type = Enums.get(UID(...));
event_type.elmName(MY_TYPE_VALUE);
But can't find a way to convert int to code editor Enum.
I tried:
Code:
event_type[my_int];
...but gives me error cannot convert EE:Enum to MY_TYPE. Tried casting and no result.
Or maybe I need to write some custom function with int parameter and returning MY_TYPE?
Thank you, Tiago
(This post was last modified: 05-16-2015 11:40 AM by tiagolapa.)
|
|
05-16-2015 11:40 AM |
|
Esenthel
Administrator
|
RE: Convert int to code editor Enum
If you already have MY_TYPE_VALUE then just use MY_TYPE_VALUE.
If you have "int x", then use MY_TYPE(x).
|
|
05-16-2015 10:06 PM |
|
tiagolapa
Member
|
RE: Convert int to code editor Enum
Yo, it works
But editor don't show help text like other functions do, so I never tried it before. Thanks!
|
|
05-16-2015 10:31 PM |
|