Fixed issue: #101
This commit is contained in:
@@ -179,10 +179,22 @@ public class Globals extends LuaTable {
|
||||
* @throws LuaError if the file could not be loaded.
|
||||
*/
|
||||
public LuaValue loadfile(String filename) {
|
||||
InputStream is = null;
|
||||
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) {
|
||||
return error("load "+filename+": "+e);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user