Add LuaData, a reference type that restores itself over Lua resets. This

works only with static data types that can be restored: tables, strings,
numbers, and not functions, userdata, etc.
This commit is contained in:
Glenn Maynard
2005-02-16 00:38:40 +00:00
parent f0a2c6faff
commit 6175a16f24
3 changed files with 71 additions and 8 deletions
+6 -1
View File
@@ -202,7 +202,11 @@ LuaManager::~LuaManager()
void LuaManager::ResetState()
{
if( L != NULL )
{
LuaReference::BeforeResetAll();
lua_close( L );
}
L = lua_open();
ASSERT( L );
@@ -212,6 +216,7 @@ void LuaManager::ResetState()
luaopen_base( L );
luaopen_math( L );
luaopen_string( L );
luaopen_table( L );
lua_settop(L, 0); // luaopen_* pushes stuff onto the stack that we don't need
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
@@ -226,7 +231,7 @@ void LuaManager::ResetState()
}
}
LuaReference::ReRegisterAll();
LuaReference::AfterResetAll();
}
void LuaManager::PrepareExpression( CString &sInOut )