mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 15:40:10 +00:00
Merge branch 'theluareloaded' into 'master'
Check the result of loading from bytecode Closes #7787 See merge request OpenMW/openmw!4189
This commit is contained in:
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…
x
Reference in New Issue
Block a user