The Lua state needs to be reset on a theme change to reload scripts

This commit is contained in:
Chris Danford
2005-01-24 03:05:37 +00:00
parent cd9c48d645
commit ed6aa8b02e
3 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -147,7 +147,7 @@ LuaManager::LuaManager()
RageException::Throw("%s", jbuf_error.c_str());
L = NULL;
Init();
ResetState();
}
LuaManager::~LuaManager()
@@ -155,7 +155,7 @@ LuaManager::~LuaManager()
lua_close( L );
}
void LuaManager::Init()
void LuaManager::ResetState()
{
if( L != NULL )
lua_close( L );
+1 -1
View File
@@ -19,7 +19,7 @@ public:
bool RunScriptFile( const CString &sFile );
/* Reset the environment, freeing any globals left over by previously executed scripts. */
void Init();
void ResetState();
/* Run a complete script in the global environment, which returns no value. */
bool RunScript( const CString &sScript );
+2
View File
@@ -276,6 +276,8 @@ void ThemeManager::SwitchThemeAndLanguage( const CString &sThemeName, const CStr
void ThemeManager::UpdateLuaGlobals()
{
LUA->ResetState();
/* Important: explicitly refresh cached metrics that we use. */
THEME_SCREEN_WIDTH.Read();
THEME_SCREEN_HEIGHT.Read();