Glenn Maynard 3d79319c04 Register Lua enum types as strings, not numbers.
- Even though these strings are in the context of the table, we still prefix them
   with the enum name ("UnlockRequirement_ArcadePoints", not "ArcadePoints").  The typical
   use is as a simple string (obj:Call("Type")), not as an index into the table, and
   this makes the type clear and easy to search for in that case.
 - no "NUM_UnlockRequirement"; use #UnlockRequirement.
 - no UnlockRequirement_Invalid; use nil
 - Enum<X>::Check always returns a valid X; no additional error checking is
   needed and Lua code can no longer introduce invalid enum values into C
 - This does not support enum types with holes; neither does FOREACH.
 - This is typesafe.  If you give "GAME_CONTROLLER_1" to a function expecting an
   UnlockRequirement, we can detect the error and show a meaningful error message.
 - Lua strings are always merged, and comparisons are as cheap as integers, so
   this isn't slow (and may be faster).
 - Can iterate: for i,j in ipairs(UnlockEntry) do func(j) end
   (This is a bit clumsy; probably want a foreach() iterator that doesn't return i)
 - ThemeMetric<UnlockRequirement> just works.
2006-09-26 01:41:40 +00:00
S
Description
Languages
C++ 85.7%
Lua 4.3%
C 4.3%
Rich Text Format 2.3%
CMake 1.1%
Other 2%