本文整理汇总了Java中org.luaj.vm2.LoadState.load方法的典型用法代码示例。如果您正苦于以下问题:Java LoadState.load方法的具体用法?Java LoadState.load怎么用?Java LoadState.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.luaj.vm2.LoadState
的用法示例。
在下文中一共展示了LoadState.load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadScript
import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
* Loads a script into the global table
*
* @param name The name of the file
* @return The loaded LuaFunction
* @throws IOException
*/
private LuaValue loadScript(String name) throws IOException {
InputStream script = this.findResource(name + ".lua");
if (script == null) fail("Could not load script for test case: " + name);
try {
return LoadState.load(script, "@" + name + ".lua", globals);
} finally {
script.close();
}
}
示例2: execute
import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
protected static void execute(LuaTable globals, boolean compileOnly) {
if (QUIET) installQuite(globals);
try {
InputStream aesStream = PerformanceRunner.class.getResourceAsStream("/org/squiddev/luaj/luajc/aes/AesLua.lua");
InputStream speedStream = PerformanceRunner.class.getResourceAsStream("/org/squiddev/luaj/luajc/aes/AesSpeed.lua");
long start = System.nanoTime();
LuaFunction aes = LoadState.load(aesStream, "AesLua.lua", globals);
LuaFunction speed = LoadState.load(speedStream, "AesSpeed.lua", globals);
long compiled = System.nanoTime();
if (!compileOnly) {
aes.invoke();
for (int i = 0; i < 10; i++) {
speed.invoke();
}
}
long finished = System.nanoTime();
System.out.printf("\n\tCompilation: %1$f\n\tRunning: %2$f\n", (compiled - start) / 1e9, (finished - compiled) / 1e9);
System.out.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例3: load
import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
public void load() throws IOException {
for (int i = 0; i < 10; i++) {
LoadState.load(Loader.load("compileonly/" + name), name + ".lua", globals);
}
}
示例4: testLuaJC
import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
@Test
public void testLuaJC() throws Exception {
Loader.install(0);
LoadState.load(Loader.load("compileonly/" + name), name + ".lua", globals);
}