Fixed issue: #101

This commit is contained in:
UnlegitDqrk
2026-03-02 11:58:39 +01:00
parent 1d3459e0d3
commit 85ed36de51

View File

@@ -179,10 +179,22 @@ public class Globals extends LuaTable {
* @throws LuaError if the file could not be loaded. * @throws LuaError if the file could not be loaded.
*/ */
public LuaValue loadfile(String filename) { public LuaValue loadfile(String filename) {
InputStream is = null;
try { try {
return load(finder.findResource(filename), "@"+filename, "bt", this); is = finder.findResource(filename);
if (is == null) {
return error("cannot open " + filename + ": No such file or directory");
}
return load(is, "@"+filename, "bt", this);
} catch (Exception e) { } catch (Exception e) {
return error("load "+filename+": "+e); return error("load "+filename+": "+e);
} finally {
if (is != null) {
try {
is.close();
} catch (Exception ignored) {
}
}
} }
} }