I have an enumerator type:
enum PlayerProps {
Attempts;
Gold;
Diamonds;
}
What should I do to iterate through all enum values? Something like:
var props = new Map<PlayerProps, Int>();
for (prop in PlayerProps)
props[prop] = 0;
I have an enumerator type:
enum PlayerProps {
Attempts;
Gold;
Diamonds;
}
What should I do to iterate through all enum values? Something like:
var props = new Map<PlayerProps, Int>();
for (prop in PlayerProps)
props[prop] = 0;
What you are looking for is Type.allEnums()
:
for (prop in Type.allEnums(PlayerProps))
Working example on try.haxe.org.
var mProps:EnumValueMap<PlayerProps,Int> = new EnumValueMap()
and see if that makes a difference... –
Genuine © 2022 - 2024 — McMap. All rights reserved.