| 12 | using namespace Ubpa::UECS; |
| 13 | |
| 14 | void LuaScriptQueueSystem::OnUpdate(Schedule& schedule) { |
| 15 | schedule.RegisterCommand([](World* w) { |
| 16 | auto scripts = w->entityMngr.GetSingleton<LuaScriptQueue>(); |
| 17 | if (!scripts) |
| 18 | return; |
| 19 | |
| 20 | sol::state_view lua{ LuaCtxMngr::Instance().GetContext(w)->Main() }; |
| 21 | for (auto script : scripts->value) { |
| 22 | if (!script) |
| 23 | continue; |
| 24 | auto rst = lua.safe_script(script->GetText()); |
| 25 | if (!rst.valid()) { |
| 26 | sol::error err = rst; |
| 27 | spdlog::error(err.what()); |
| 28 | } |
| 29 | } |
| 30 | scripts->value.clear(); |
| 31 | }); |
| 32 | } |
nothing calls this directly
no test coverage detected