Catch failures on loading LUA files

This commit is contained in:
Ollo 2021-10-29 23:13:43 +02:00
parent eff23d14cf
commit a5ddb2994d

View File

@ -27,7 +27,7 @@ public class DoFileFunction extends OneArgFunction {
String filename = luaFilename.checkjstring();
File f = new File(workingDir.getAbsolutePath() + File.separator + filename);
try {
if (f.exists()) {
LuaValue chunk = this.globals.loadfile(f.getAbsolutePath());
chunk.call();
@ -35,6 +35,11 @@ public class DoFileFunction extends OneArgFunction {
} else {
return LuaValue.valueOf(false);
}
} catch (Exception e) {
System.err.println("Cannot load " + f.getName());
e.printStackTrace();
return LuaValue.valueOf(false);
}
}
public void setWorkingDirectory(File workingDir) {