当前位置: 首页>>代码示例>>Java>>正文


Java LoadState.load方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:17,代码来源:StringLibTest.java

示例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);
	}
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:29,代码来源:PerformanceRunner.java

示例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);
	}
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:6,代码来源:PerformanceCompile.java

示例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);
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:6,代码来源:CompileOnlyTest.java


注:本文中的org.luaj.vm2.LoadState.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。