LuaManager::L -> m_pLuaMain

This commit is contained in:
Glenn Maynard
2006-10-14 20:49:35 +00:00
parent 48d3733296
commit 3dc13b568a
2 changed files with 8 additions and 7 deletions
+7 -6
View File
@@ -158,10 +158,11 @@ LuaManager::LuaManager()
m_pLock = new RageMutex( "Lua" ); m_pLock = new RageMutex( "Lua" );
L = lua_open(); lua_State *L = lua_open();
ASSERT( L ); ASSERT( L );
lua_atpanic( L, LuaPanic ); lua_atpanic( L, LuaPanic );
m_pLuaMain = L;
luaopen_base( L ); luaopen_base( L );
luaopen_math( L ); luaopen_math( L );
@@ -175,7 +176,7 @@ LuaManager::LuaManager()
LuaManager::~LuaManager() LuaManager::~LuaManager()
{ {
lua_close( L ); lua_close( m_pLuaMain );
delete m_pLock; delete m_pLock;
} }
@@ -188,20 +189,20 @@ Lua *LuaManager::Get()
m_pLock->Lock(); m_pLock->Lock();
if( size_t(g_iNumStackCounts) < ARRAYLEN(g_iStackCounts) ) if( size_t(g_iNumStackCounts) < ARRAYLEN(g_iStackCounts) )
{ {
g_iStackCounts[g_iNumStackCounts] = lua_gettop( L ); g_iStackCounts[g_iNumStackCounts] = lua_gettop( m_pLuaMain );
} }
++g_iNumStackCounts; ++g_iNumStackCounts;
return L; return m_pLuaMain;
} }
void LuaManager::Release( Lua *&p ) void LuaManager::Release( Lua *&p )
{ {
ASSERT( p == L ); ASSERT( p == m_pLuaMain );
ASSERT( g_iNumStackCounts != 0 ); ASSERT( g_iNumStackCounts != 0 );
--g_iNumStackCounts; --g_iNumStackCounts;
if( size_t(g_iNumStackCounts) < ARRAYLEN(g_iStackCounts) ) if( size_t(g_iNumStackCounts) < ARRAYLEN(g_iStackCounts) )
{ {
ASSERT( g_iStackCounts[g_iNumStackCounts] == lua_gettop(L) ); ASSERT( g_iStackCounts[g_iNumStackCounts] == lua_gettop(m_pLuaMain) );
} }
m_pLock->Unlock(); m_pLock->Unlock();
p = NULL; p = NULL;
+1 -1
View File
@@ -38,7 +38,7 @@ public:
XNode *GetLuaInformation() const; XNode *GetLuaInformation() const;
private: private:
lua_State *L; lua_State *m_pLuaMain;
RageMutex *m_pLock; RageMutex *m_pLock;
}; };