mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2026-10-10 20:03:09 +08:00
fix(lua) (#1697)
- sandbox stuff. - Fix lua scripts that could run when their lua state was destroyed, causing chaos.
This commit is contained in:
@@ -33,6 +33,11 @@ namespace big
|
||||
m_scripts.clear();
|
||||
}
|
||||
|
||||
void script_mgr::add_on_script_batch_removed(std::function<void()> f)
|
||||
{
|
||||
m_on_script_batch_removed.push(f);
|
||||
}
|
||||
|
||||
void script_mgr::tick()
|
||||
{
|
||||
gta_util::execute_as_script(RAGE_JOAAT("main_persistent"), std::mem_fn(&script_mgr::tick_internal), this);
|
||||
@@ -62,6 +67,18 @@ namespace big
|
||||
return iter->m_should_be_deleted;
|
||||
});
|
||||
|
||||
while (m_on_script_batch_removed.size())
|
||||
{
|
||||
auto& f = m_on_script_batch_removed.front();
|
||||
|
||||
if (f)
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
m_on_script_batch_removed.pop();
|
||||
}
|
||||
|
||||
if (g_lua_manager->m_schedule_reload_modules)
|
||||
{
|
||||
g_lua_manager->load_all_modules();
|
||||
|
||||
Reference in New Issue
Block a user