From 51db0029c0f93c5c94ace6437edf759403db5b32 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sun, 30 Mar 2008 04:27:28 +0000 Subject: [PATCH] Document the Enum namespace. --- stepmania/Docs/LuaDocumentation.xml | 41 +++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/stepmania/Docs/LuaDocumentation.xml b/stepmania/Docs/LuaDocumentation.xml index 92ada3deea..d0dd43d1aa 100644 --- a/stepmania/Docs/LuaDocumentation.xml +++ b/stepmania/Docs/LuaDocumentation.xml @@ -92,8 +92,45 @@ - - Reverses an named enum to its value. Replace Enum with the actual num class. + + Enumerated types are lookup tables associating a string to each numerical + value for each Enum. For example, + [1] would be the + string 'PlayerNumber_P1'.
+ The functions defined in the Enum namespace are valid member + functions of every Enum where the first argument is + omitted and the name of the Enum is used in place + of Enum. Instead of + Enum.GetName( + ) or + Enum.Reverse( + ), one can use + :GetName() or + :Reverse(), respectively. +
+ + Both x and y need to be elements of the enumerated + type e. Returns a value less than/greater than/equal to + 0 corresponding to the numerical value of x being + less than/greater than/equal to the numerical value of y as + determined by + Enum.Reverse( e ). + + + Returns the type of e. For example, + Enum.GetName( ) + will return the string 'PlayerNumber'. + + + Returns a reverse lookup table for the enumerated type e. For + example:
local r = + Enum.Reverse( );
+ local n = r['PlayerNumber_P2'];

+ The value of n in this case would be 1 corresponding + to the 0-based indexing using in C++ and not 2 as might be + expected for the 1-based indexing used in Lua.