Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/scripting/StarLuaRoot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/scripting/StarLuaRoot.cpp')
-rw-r--r--source/game/scripting/StarLuaRoot.cpp10
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);