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() );
+		}
+	}
+}
