Catch failures on loading LUA files
This commit is contained in:
parent
eff23d14cf
commit
a5ddb2994d
@ -27,13 +27,18 @@ public class DoFileFunction extends OneArgFunction {
|
|||||||
String filename = luaFilename.checkjstring();
|
String filename = luaFilename.checkjstring();
|
||||||
|
|
||||||
File f = new File(workingDir.getAbsolutePath() + File.separator + filename);
|
File f = new File(workingDir.getAbsolutePath() + File.separator + filename);
|
||||||
|
try {
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
LuaValue chunk = this.globals.loadfile(f.getAbsolutePath());
|
LuaValue chunk = this.globals.loadfile(f.getAbsolutePath());
|
||||||
chunk.call();
|
chunk.call();
|
||||||
return LuaValue.valueOf(true);
|
return LuaValue.valueOf(true);
|
||||||
} else {
|
} else {
|
||||||
return LuaValue.valueOf(false);
|
return LuaValue.valueOf(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("Cannot load " + f.getName());
|
||||||
|
e.printStackTrace();
|
||||||
|
return LuaValue.valueOf(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user