mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-24 04:11:50 -04:00
Merge branch 'fix_7210_48' into 'openmw-48'
!2737 for 0.48 (fixes #7210) See merge request OpenMW/openmw!2780
This commit is contained in:
commit
66bd283d4b
@ -5,6 +5,7 @@
|
|||||||
#endif // NO_LUAJIT
|
#endif // NO_LUAJIT
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
@ -273,7 +274,9 @@ namespace LuaUtil
|
|||||||
sol::function LuaState::loadInternalLib(std::string_view libName)
|
sol::function LuaState::loadInternalLib(std::string_view libName)
|
||||||
{
|
{
|
||||||
std::string path = packageNameToPath(libName, mLibSearchPaths);
|
std::string path = packageNameToPath(libName, mLibSearchPaths);
|
||||||
sol::load_result res = mLua.load_file(path, sol::load_mode::text);
|
std::ifstream stream(path);
|
||||||
|
std::string fileContent(std::istreambuf_iterator<char>(stream), {});
|
||||||
|
sol::load_result res = mLua.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("Lua error: " + res.get<std::string>());
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user