Log missing scripts

This commit is contained in:
Kae 2023-08-04 23:47:39 +10:00
parent 2185e87eb2
commit 65bacddc67

View File

@ -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)
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);