tolerate Register being called before THEME is initialized (like we do

with other singletons)
This commit is contained in:
Glenn Maynard
2005-03-18 22:44:47 +00:00
parent 627e5eb16a
commit df896d168a
+9 -5
View File
@@ -882,11 +882,15 @@ public:
ADD_METHOD( GetPath )
Luna<T>::Register( L );
// add global singleton
ASSERT( THEME );
lua_pushstring(L, "THEME");
THEME->PushSelf( LUA->L );
lua_settable(L, LUA_GLOBALSINDEX);
// Add global singleton if constructed already. If it's not constructed yet,
// then we'll register it later when we reinit Lua just before
// initializing the display.
if( THEME )
{
lua_pushstring(L, "THEME");
THEME->PushSelf( LUA->L );
lua_settable(L, LUA_GLOBALSINDEX);
}
}
};