diff --git a/src/client/game/scripting/lua/context.cpp b/src/client/game/scripting/lua/context.cpp index ef68991..6d61284 100644 --- a/src/client/game/scripting/lua/context.cpp +++ b/src/client/game/scripting/lua/context.cpp @@ -301,7 +301,7 @@ namespace scripting::lua context::~context() { - this->state_.collect_garbage(); + this->collect_garbage(); this->scheduler_.clear(); this->event_handler_.clear(); this->state_ = {}; @@ -310,12 +310,18 @@ namespace scripting::lua void context::run_frame() { this->scheduler_.run_frame(); - this->state_.collect_garbage(); + this->collect_garbage(); } void context::notify(const event& e) { this->event_handler_.dispatch(e); + this->collect_garbage(); + } + + void context::collect_garbage() + { + this->state_.collect_garbage(); } void context::load_script(const std::string& script) diff --git a/src/client/game/scripting/lua/context.hpp b/src/client/game/scripting/lua/context.hpp index 9ba85fb..79a5e90 100644 --- a/src/client/game/scripting/lua/context.hpp +++ b/src/client/game/scripting/lua/context.hpp @@ -30,6 +30,7 @@ namespace scripting::lua void run_frame(); void notify(const event& e); + void collect_garbage(); private: sol::state state_{};