Commit Graph

17 Commits

Author SHA1 Message Date
Glenn Maynard ed6141c48f By default, don't return Invalid values from Enum::Check. It's the exception
that Invalid has a meaning for an API call; most do not.  As it was, every
function that used Enum::Check should have been checking for invalid
return values; this way, the check can be omitted.

(This applies to FromString, Pop and FromStack, too; I havn't decided
whether I want to propagate this into those.)
2006-10-11 05:18:12 +00:00
Glenn Maynard afa611c36d fix error handling 2006-10-09 01:15:09 +00:00
Glenn Maynard 44bd9f7582 fix stack imbalance 2006-10-07 07:42:25 +00:00
Glenn Maynard 76dea048fc __type 2006-10-06 01:07:53 +00:00
Glenn Maynard 72a24d459c set type 2006-10-06 00:40:02 +00:00
Glenn Maynard 3407b92ede bind the enum table to a methods table 2006-10-05 23:08:42 +00:00
Glenn Maynard c1cdce72aa better error message 2006-10-05 02:45:05 +00:00
Glenn Maynard cd8f1fc1c6 "I made this"
lua_replace -> lua_remove
2006-09-30 21:55:31 +00:00
Glenn Maynard 2baddd84fc COMPILE_ASSERT XToString table sizes
pull out common XToString code
simplify XToString
2006-09-27 04:19:47 +00:00
Glenn Maynard f567a0fd28 cleanup arg order 2006-09-26 08:54:54 +00:00
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
Glenn Maynard 664a4944fd remove unused 2006-02-02 08:51:28 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Chris Danford fc18dbd342 make more strings localizable 2006-01-08 18:40:20 +00:00
Chris Danford dc35d10ee4 move our CStirng into a namespace to fix conflict with MFC 2005-12-09 19:15:31 +00:00
Glenn Maynard 2cab5c4689 license updates 2004-05-31 22:42:12 +00:00
Chris Danford 08d952c9c4 add helper enum class 2004-04-07 20:50:24 +00:00