The Lua state needs to be reset on a theme change to reload scripts
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user