Reverse enumeration lookup

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Reverse enumeration lookup

Post by Trond »

Code: Select all

Enumeration 0, EnumName
  #Test
  #Toast
  #Debugging
EndEnumeration

A = #Debugging
Show.s = ConstantString(A, EnumName)
; Show = "#Debugging"
Handy for debugging and logging purposes. Of course, the constant names would not be included in the executable if ConstantString() was not used with that EnumName.