diff --git a/components/lua/luastate.cpp b/components/lua/luastate.cpp index 0d106cb119..76c574a334 100644 --- a/components/lua/luastate.cpp +++ b/components/lua/luastate.cpp @@ -5,6 +5,7 @@ #endif // NO_LUAJIT #include +#include #include #include @@ -273,7 +274,9 @@ namespace LuaUtil sol::function LuaState::loadInternalLib(std::string_view libName) { 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(stream), {}); + sol::load_result res = mLua.load(fileContent, path, sol::load_mode::text); if (!res.valid()) throw std::runtime_error("Lua error: " + res.get()); return res;