public class LuaJC extends Object implements Globals.Loader
Globals.Compiler which does direct
lua-to-java-bytecode compiling.
By default, when using JsePlatform or
org.luaj.vm2.lib.jme.JmePlatform
to construct globals, the plain compiler LuaC is installed and lua code
will only be compiled into lua bytecode and execute as LuaClosure.
To override the default compiling behavior with LuaJC
lua-to-java bytecode compiler, install it before undumping code,
for example:
LuaValue globals = JsePlatform.standardGlobals();
LuaJC.install(globals);
LuaValue chunk = globals.load( "print('hello, world'), "main.lua");
System.out.println(chunk.isclosure()); // Will be false when LuaJC is working.
chunk.call();
This requires the bcel library to be on the class path to work as expected.
If the library is not found, the default LuaC lua-to-lua-bytecode
compiler will be used.
Globals.compiler,
install(Globals),
LuaC,
LuaValue| 限定符 | 构造器和说明 |
|---|---|
protected |
LuaJC() |
| 限定符和类型 | 方法和说明 |
|---|---|
Hashtable |
compileAll(InputStream script,
String chunkname,
String filename,
Globals globals,
boolean genmain) |
Hashtable |
compileAll(Reader script,
String chunkname,
String filename,
Globals globals,
boolean genmain) |
static void |
install(Globals G)
Install the compiler as the main Globals.Loader to use in a set of globals.
|
LuaFunction |
load(Prototype p,
String name,
Globals globals,
LuaValue env)
Convert the prototype into a LuaFunction with the supplied environment.
|
LuaFunction |
load(Prototype p,
String name,
LuaValue globals) |
public static final LuaJC instance
public static final void install(Globals G)
public Hashtable compileAll(InputStream script, String chunkname, String filename, Globals globals, boolean genmain) throws IOException
IOExceptionpublic Hashtable compileAll(Reader script, String chunkname, String filename, Globals globals, boolean genmain) throws IOException
IOExceptionpublic LuaFunction load(Prototype p, String name, LuaValue globals) throws IOException
IOExceptionpublic LuaFunction load(Prototype p, String name, Globals globals, LuaValue env) throws IOException
Globals.Loaderload 在接口中 Globals.LoaderIOExceptionCopyright © 2020. All rights reserved.