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.
|
* @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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user