Set callbacks to nil and collect garbage when unloading level.

This commit is contained in:
hispidence 2021-08-27 12:46:01 +01:00
parent 770a791c0d
commit 578724a9c6

View file

@ -442,6 +442,12 @@ void GameScript::FreeLevelScripts()
m_levelFuncs.clear();
m_locals = LuaVariables{};
ResetLevelTables();
m_onStart = sol::nil;
m_onLoad = sol::nil;
m_onControlPhase = sol::nil;
m_onSave = sol::nil;
m_onEnd = sol::nil;
m_lua->collect_garbage();
}
void JumpToLevel(int levelNum)