diff --git a/src/lua/lua_module.cpp b/src/lua/lua_module.cpp index 5b1da583..d48844b7 100644 --- a/src/lua/lua_module.cpp +++ b/src/lua/lua_module.cpp @@ -231,8 +231,11 @@ namespace big { std::lock_guard guard(m_registered_scripts_mutex); - for (auto& script : m_registered_scripts) + const auto script_count = m_registered_scripts.size(); + for (size_t i = 0; i < script_count; i++) { + const auto script = m_registered_scripts[i].get(); + if (script->is_enabled()) { script->tick();