diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-08-04 23:47:39 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-08-04 23:47:39 +1000 |
commit | 65bacddc67942e8678626016960431cdecef2030 (patch) | |
tree | 4a0b8f74dcd79eca51647042704b550d15c4dd08 /source/game/scripting/StarLuaRoot.cpp | |
parent | 2185e87eb275295dee9d2fbbd4ca5bc84c6671ad (diff) |
Log missing scripts
Diffstat (limited to 'source/game/scripting/StarLuaRoot.cpp')
-rw-r--r-- | source/game/scripting/StarLuaRoot.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/game/scripting/StarLuaRoot.cpp b/source/game/scripting/StarLuaRoot.cpp index 152bbec..c538df1 100644 --- a/source/game/scripting/StarLuaRoot.cpp +++ b/source/game/scripting/StarLuaRoot.cpp @@ -111,8 +111,14 @@ LuaContext LuaRoot::createContext(StringList const& scriptPaths) { return newContext.engine().createFunctionFromSource(newContext.handleIndex(), source.utf8Ptr(), source.utf8Size(), functionName.utf8Ptr()); })); - for (auto const& scriptPath : scriptPaths) - cache->loadContextScript(newContext, scriptPath); + auto assets = Root::singleton().assets(); + + for (auto const& scriptPath : scriptPaths) { + if (assets->assetExists(scriptPath)) + cache->loadContextScript(newContext, scriptPath); + else + Logger::error("Script '{}' does not exist", scriptPath); + } for (auto const& callbackPair : m_luaCallbacks) newContext.setCallbacks(callbackPair.first, callbackPair.second); |