About Store Forum Documentation Contact
Donations:
158$/mo



Post Reply 
Convert int to code editor Enum
Author Message
tiagolapa Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
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
Find all posts by this user Quote this message in a reply
tiagolapa Offline
Member

Post: #3
RE: Convert int to code editor Enum
Yo, it workssmile

But editor don't show help text like other functions do, so I never tried it before. Thanks!
05-16-2015 10:31 PM
Find all posts by this user Quote this message in a reply
Post Reply