mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 09:45:36 +00:00
Fix #7210
This commit is contained in:
parent
a0cea6569b
commit
b71eac3e76
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
#endif // NO_LUAJIT
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/files/conversion.hpp>
|
||||
|
@ -385,7 +386,9 @@ namespace LuaUtil
|
|||
sol::function LuaState::loadInternalLib(std::string_view libName)
|
||||
{
|
||||
const auto path = packageNameToPath(libName, mLibSearchPaths);
|
||||
sol::load_result res = mSol.load_file(Files::pathToUnicodeString(path), sol::load_mode::text);
|
||||
std::ifstream stream(path);
|
||||
std::string fileContent(std::istreambuf_iterator<char>(stream), {});
|
||||
sol::load_result res = mSol.load(fileContent, Files::pathToUnicodeString(path), sol::load_mode::text);
|
||||
if (!res.valid())
|
||||
throw std::runtime_error("Lua error: " + res.get<std::string>());
|
||||
return res;
|
||||
|
|
Loading…
Reference in a new issue