Skip to content

Instantly share code, notes, and snippets.

@andyhuey
Last active December 18, 2015 18:19
Show Gist options
  • Select an option

  • Save andyhuey/5824996 to your computer and use it in GitHub Desktop.

Select an option

Save andyhuey/5824996 to your computer and use it in GitHub Desktop.
Strange behavior from DictEnum class
static void AjhDictEnumTest(Args _args)
{
// originally from http://arsalanax.blogspot.com/2012/02/get-values-of-base-enums-using-code-in.html
EnumId enumId = enumNum(ActionType);
DictEnum dictEnum = new DictEnum(enumId);
int nElements = dictEnum.values();
int i;
for (i=0; i < nElements; i++)
{
print dictEnum.index2Label(i); // this returns the label.
print dictEnum.index2Name(i); // this also returns the label!
print dictEnum.index2Symbol(i); // this returns the name.
print dictEnum.index2Value(i); // this returns the number.
}
pause;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment