Fix loadVFS error handling

BindlessTest
uramer 11 months ago committed by Anton Uramer
parent aa4303fc38
commit 550659c2d9

@ -376,7 +376,7 @@ namespace LuaUtil
sol::protected_function_result LuaState::throwIfError(sol::protected_function_result&& res) sol::protected_function_result LuaState::throwIfError(sol::protected_function_result&& res)
{ {
if (!res.valid() && static_cast<int>(res.get_type()) == LUA_TSTRING) if (!res.valid())
throw std::runtime_error(std::string("Lua error: ") += res.get<sol::error>().what()); throw std::runtime_error(std::string("Lua error: ") += res.get<sol::error>().what());
else else
return std::move(res); return std::move(res);
@ -397,7 +397,7 @@ namespace LuaUtil
std::string fileContent(std::istreambuf_iterator<char>(*mVFS->get(path)), {}); std::string fileContent(std::istreambuf_iterator<char>(*mVFS->get(path)), {});
sol::load_result res = mSol.load(fileContent, path, sol::load_mode::text); sol::load_result res = mSol.load(fileContent, path, sol::load_mode::text);
if (!res.valid()) if (!res.valid())
throw std::runtime_error("Lua error: " + res.get<std::string>()); throw std::runtime_error(std::string("Lua error: ") += res.get<sol::error>().what());
return res; return res;
} }

Loading…
Cancel
Save