Index: code/parse/lua.cpp
===================================================================
--- code/parse/lua.cpp	(revision 9666)
+++ code/parse/lua.cpp	(working copy)
@@ -883,7 +883,7 @@
 	if(!ade_get_args(L, "o", l_Enum.GetPtr(&e)))
 		return ade_set_args(L, "s", "<INVALID>");
 
-	if(e->index < 0 || e->index >= (int)Num_enumerations)
+	if(e->index < 1 || e->index >= ENUM_NEXT_INDEX)
 		return ade_set_args(L, "s", "<INVALID>");
 
 	uint i;
