Merge branch 'theluareloaded' into 'master'

Check the result of loading from bytecode

Closes #7787

See merge request OpenMW/openmw!4189
pull/3236/head
psi29a 6 months ago
commit 9a864f309a

@ -386,7 +386,14 @@ namespace LuaUtil
{
auto iter = mCompiledScripts.find(path);
if (iter != mCompiledScripts.end())
return mSol.load(iter->second.as_string_view(), path, sol::load_mode::binary);
{
sol::load_result res = mSol.load(iter->second.as_string_view(), path, sol::load_mode::binary);
// Unless we have memory corruption issues, the bytecode is valid at this point, but loading might still
// fail because we've hit our Lua memory cap
if (!res.valid())
throw std::runtime_error("Lua error: " + res.get<std::string>());
return res;
}
sol::function res = loadFromVFS(path);
mCompiledScripts[path] = res.dump();
return res;

Loading…
Cancel
Save