Index: /trunk/nv/lua/lua_state.hh
===================================================================
--- /trunk/nv/lua/lua_state.hh	(revision 162)
+++ /trunk/nv/lua/lua_state.hh	(revision 163)
@@ -89,4 +89,5 @@
 			reference register_object( object * o );
 			void unregister_object( object * o );
+			void register_enum( type_database* db, const std::string& name, const std::string& prefix = std::string() );
 			operator lua_State*() { return L; }
 			~state();
Index: /trunk/src/lua/lua_state.cc
===================================================================
--- /trunk/src/lua/lua_state.cc	(revision 162)
+++ /trunk/src/lua/lua_state.cc	(revision 163)
@@ -372,2 +372,20 @@
 	}
 }
+
+void lua::state::register_enum( type_database* db, const std::string& name, const std::string& prefix /*= std::string() */ )
+{
+	type_entry* et = db->get_type( name );
+
+	for ( const auto& entry : et->enum_list )
+	{
+		lua_pushinteger( L, entry.value );
+		if ( prefix.empty() )
+		{
+			lua_setglobal( L, entry.name.c_str() );
+		}
+		else
+		{
+			lua_setglobal( L, ( prefix + entry.name ).c_str() );
+		}
+	}
+}
