MCPcopy Create free account
hub / github.com/Ubpa/Utopia / OnUpdate

Method OnUpdate

src/ScriptSystem/LuaScriptQueueSystem.cpp:14–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace Ubpa::UECS;
13
14void 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}

Callers

nothing calls this directly

Calls 2

MainMethod · 0.80
GetContextMethod · 0.80

Tested by

no test coverage detected