Value enums

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Value enums

Yanis Benson

What is the right way to get value from string/int enum? I guess I can use untyped (haven't tried yet) (and of course I can write using function for that), but is it the right way? I want to use that to speed up some things and have nice enum sugar and checking. Same for backward converting.


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Value enums

Nicolas Cannasse
Le 25/10/2011 20:43, Yanis Benson a écrit :
> What is the right way to get value from string/int enum? I guess I can
> use untyped (haven't tried yet) (and of course I can write using
> function for that), but is it the right way? I want to use that to speed
> up some things and have nice enum sugar and checking. Same for backward
> converting.

Check Type.enumIndex, Type.enumConstructor and
Type.createEnum/createEnumIndex

Best,
Nicolas


--
haXe - an open source web programming language
http://haxe.org