Removed require from scripts folder

This commit is contained in:
KiritoDv 2025-04-23 16:35:27 -06:00
parent e70b578e0d
commit dc76025a7f

View file

@ -83,22 +83,12 @@ int ScriptingLayer::Require(lua_State* L) {
std::optional<std::string> result = LoadFromO2R(path);
if(!result.has_value()){
// TODO: This could be unsafe, validate it
const auto error = "Failed to load " + path + ", from both O2R and disk";
std::ifstream input("scripts/" + path);
if (!input.is_open()) {
const auto error = "Failed to include " + path;
SPDLOG_ERROR(error);
sol::stack::push(L, error);
return 0;
}
std::vector<uint8_t> data = std::vector<uint8_t>(std::istreambuf_iterator(input), {});
input.close();
result = std::string(data.begin(), data.end());
}
const auto& script = result.value();
luaL_loadbuffer(
L, script.data(), script.size(), path.c_str());