Hi, I tried run lua bytecode compiled with 'module' in source, but I got this exception:
org.luaj.vm2.LuaError: 'module' not called from a Lua function
To fix it I change a cheking at module(Varargs args) method, in PackageLib.java:246
if ( ! f.isclosure() )
error("'module' not called from a Lua function");
I change this to:
if ( ! f.isclosure() && ! f.isfunction() )
error("'module' not called from a Lua function");
Then I got a problem in DebugLib:
68 public static final boolean CALLS = (null != System.getProperty("CALLS"));
69 public static final boolean TRACE = (null != System.getProperty("TRACE"));
System.getProperty gen a exception, then I made a function to catch:
public static final boolean CALLS = (null != getProperty("CALLS"));
public static final boolean TRACE = (null != getProperty("TRACE"));
public static String getProperty(String prop) {
try {
return System.getProperty(prop);
} catch(Throwable ex) {
return null;
}
}
With these small changes, my lua module running perfect through java bytecode
I hope help this project and sorry my bad english.