• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JseBaseLib类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.luaj.vm2.lib.jse.JseBaseLib的典型用法代码示例。如果您正苦于以下问题:Java JseBaseLib类的具体用法?Java JseBaseLib怎么用?Java JseBaseLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JseBaseLib类属于org.luaj.vm2.lib.jse包,在下文中一共展示了JseBaseLib类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    //Globals globals = JsePlatform.standardGlobals();
    Globals globals = new Globals();
    globals.load(new JseBaseLib());
    globals.load(new PackageLib());
    globals.load(new Bit32Lib());
    globals.load(new TableLib());
    globals.load(new StringLib());
    globals.load(new CoroutineLib());
    globals.load(new JseMathLib());
    globals.load(new JseIoLib());
    globals.load(new JseOsLib());
    globals.load(new JavaLibInteractionTest());
    LoadState.install(globals);
    LuaC.install(globals);
    System.out.println(new File(".").getAbsolutePath());
    System.out.println(new File(args[0]).exists());
    LuaValue chunk = globals.loadfile(new File(args[0]).getAbsolutePath());
    chunk.call();
}
 
开发者ID:LukkitPlus,项目名称:Lukkit,代码行数:21,代码来源:JavaLibInteractionTest.java


示例2: setupCompilerGlobal

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
private static Globals setupCompilerGlobal() {
	// Create server globals with just enough library support to compile user
	// scripts.
	compiler = new Globals();
	compiler.load(new JseBaseLib());
	compiler.load(new PackageLib());
	compiler.load(new StringLib());

	// To load scripts, we occasionally need a math library in addition to compiler
	// support.
	// To limit scripts using the debug library, they must be closures, so we only
	// install LuaC.
	compiler.load(new JseMathLib());
	LoadState.install(compiler);
	LuaC.install(compiler);

	// Set up the LuaString metatable to be read-only since it is shared across all
	// scripts.
	LuaString.s_metatable = new ReadOnlyLuaTable(LuaString.s_metatable);
	return compiler;
}
 
开发者ID:hamilton-lima,项目名称:robolucha,代码行数:22,代码来源:LuaVM.java


示例3: LuaScriptExecutorPool

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
public LuaScriptExecutorPool(GameScriptingEngine gameScriptingEngine, int poolSize, boolean sandboxed) {
	this.gameScriptingEngine = gameScriptingEngine;
	this.sandboxed = sandboxed;
	
	executors = new ArrayBlockingQueue<ScriptExecutor<LuaValue>>(poolSize);

	for (int i = 0; i < poolSize; i++) {
		executors.offer(new LuaScriptExecutor(this));
	}
	
	if(sandboxed) {
		//Create sandboxed compiler
		sandboxedGlobals = new Globals();
		sandboxedGlobals.load(new JseBaseLib());
		sandboxedGlobals.load(new PackageLib());
		sandboxedGlobals.load(new StringLib());

		// To load scripts, we occasionally need a math library in addition to compiler support.
		// To limit scripts using the debug library, they must be closures, so we only install LuaC.
		sandboxedGlobals.load(new JseMathLib());
		LoadState.install(sandboxedGlobals);
		LuaC.install(sandboxedGlobals);
	}
}
 
开发者ID:mini2Dx,项目名称:miniscript,代码行数:25,代码来源:LuaScriptExecutorPool.java


示例4: makeGlobals

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
public static LuaTable makeGlobals(boolean stdout) {
	LuaTable globals = JsePlatform.debugGlobals();

	if (!stdout) {
		JseBaseLib lib = new JseBaseLib();
		lib.STDOUT = new PrintStream(new OutputStream() {
			@Override
			public void write(int b) throws IOException {
			}
		});

		globals.load(lib);
	}
	globals.set("assertEquals", new AssertFunction());
	globals.set("assertMany", new AssertManyFunction());
	globals.set("makeError", new MakeErrorFunction());

	return globals;
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:20,代码来源:LuaEnv.java


示例5: LuaEngine

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
private LuaEngine() {
	globals = new Globals();
	globals.load(new JseBaseLib());
	globals.load(new PackageLib());
	globals.load(new Bit32Lib());
	globals.load(new TableLib());
	globals.load(new StringLib());
	globals.load(new CoroutineLib());
	globals.load(new JseMathLib());
	globals.load(new JseIoLib());
	globals.load(new JseOsLib());
	globals.load(new MultiDexLuajavaLib());
	LoadState.install(globals);
	LuaC.install(globals);

	globals.finder = this;
	globals.set("loadResource", new resLoader());
}
 
开发者ID:NYRDS,项目名称:pixel-dungeon-remix,代码行数:19,代码来源:LuaEngine.java


示例6: loadCoreLibs

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
public static void loadCoreLibs() {
    GLOBAL_PATH.load(new JseBaseLib());
    GLOBAL_PATH.load(new PackageLib());
    GLOBAL_PATH.load(new Bit32Lib());
    GLOBAL_PATH.load(new TableLib());
    GLOBAL_PATH.load(new StringLib());
    GLOBAL_PATH.load(new CoroutineLib());
    GLOBAL_PATH.load(new JseMathLib());
    GLOBAL_PATH.load(new JseIoLib());
    GLOBAL_PATH.load(new JseOsLib());
}
 
开发者ID:LukkitPlus,项目名称:Lukkit,代码行数:12,代码来源:Environment.java


示例7: getLocalCompiler

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
private Globals getLocalCompiler() {
	Globals user_globals = new Globals();
	user_globals.load(new JseBaseLib());
	user_globals.load(new PackageLib());
	user_globals.load(new Bit32Lib());
	user_globals.load(new TableLib());
	user_globals.load(new StringLib());
	user_globals.load(new JseMathLib());

	user_globals.load(new DebugLib());
	sethook = user_globals.get("debug").get("sethook");
	user_globals.set("debug", LuaValue.NIL);

	return user_globals;
}
 
开发者ID:hamilton-lima,项目名称:robolucha,代码行数:16,代码来源:LuaVM.java


示例8: newStandard

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
/**
 * Create a new lua Globals object representing the standard one used in this game
 *
 * @return a new Globals instance
 */
public static Globals newStandard() {
    Globals globals = new Globals();
    globals.load(new JseBaseLib());
    globals.load(new PackageLib());
    globals.load(new Bit32Lib());
    globals.load(new TableLib());
    globals.load(new StringLib());
    globals.load(new JseMathLib());
    LoadState.install(globals);
    LuaC.install(globals);
    LuaJC.install(globals);
    return globals;
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:19,代码来源:LuaUtils.java


示例9: loadDefaultLibs

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
private void loadDefaultLibs() {
	environment.load(new PackageLib());
	
	environment.load(new Bit32Lib());
	environment.load(new StringLib());
	environment.load(new TableLib());
	
	environment.load(new JseBaseLib());
	environment.load(new JseMathLib());
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:11,代码来源:LuaEnvironment.java


示例10: createSandboxedGlobals

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
private Globals createSandboxedGlobals() {
	Globals result = new Globals();
	result.load(new JseBaseLib());
	result.load(new PackageLib());
	result.load(new Bit32Lib());
	result.load(new TableLib());
	result.load(new StringLib());
	result.load(new JseMathLib());
	result.load(new DebugLib());
	result.set("debug", LuaValue.NIL);
	return result;
}
 
开发者ID:mini2Dx,项目名称:miniscript,代码行数:13,代码来源:LuaScriptExecutorPool.java


示例11: LuaInstance

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
public LuaInstance() throws AerospikeException {
	globals.load(new JseBaseLib());
	globals.load(new PackageLib());
	//globals.load(new Bit32Lib()); // not needed for 5.1 compatibility	
	globals.load(new TableLib());
	globals.load(new StringLib());
	globals.load(new CoroutineLib());
	globals.load(new JseMathLib());
	globals.load(new JseIoLib());
	globals.load(new JseOsLib());
	globals.load(new LuajavaLib());
	globals.load(new DebugLib());
	
	LuaTable packageTable = (LuaTable)globals.get("package");
	loadedTable = (LuaTable)packageTable.get("loaded");
	
	globals.load(new LuaBytesLib(this));
	globals.load(new LuaListLib(this));
	globals.load(new LuaMapLib(this));
	globals.load(new LuaStreamLib(this));		
	
	LuaC.install(globals);

	load("compat52", true);
	load("as", true);
	load("stream_ops", true);
	load("aerospike", true);
	
	globals.load(new LuaAerospikeLib(this));
}
 
开发者ID:otrimegistro,项目名称:aerospikez,代码行数:31,代码来源:LuaInstance.java


示例12: generateGlobals

import org.luaj.vm2.lib.jse.JseBaseLib; //导入依赖的package包/类
/**
 * Internal method.
 * 
 * <p>Generates a {@link Globals} object with all Lua
 * and Undertailor libraries loaded, used for all Lua
 * operations of Undertailor.</p>
 */
private Globals generateGlobals() {
    Globals returned = new Globals();
    LoadState.install(returned);
    LuaC.install(returned);

    // core Lua libraries
    returned.load(new JseBaseLib());
    returned.load(new PackageLib());
    returned.load(new DebugLib());
    returned.load(new Bit32Lib());
    returned.load(new TableLib());
    returned.load(new StringLib());
    returned.load(new JseMathLib());
    returned.load(new JseOsLib());

    // undertailor libraries
    returned.load(new BaseLib(this));
    returned.load(new OsLib());
    returned.load(new GameLib(undertailor));
    returned.load(new ColorsLib());
    returned.load(new TextsLib(undertailor));
    returned.load(new MetaLib());

    // Clean the globals.
    LuaValue lib = returned.get("os");
    if (lib.istable()) {
        lib.set("execute", LuaValue.NIL);
        lib.set("exit", LuaValue.NIL);
        lib.set("remove", LuaValue.NIL);
        lib.set("rename", LuaValue.NIL);
        lib.set("setlocale", LuaValue.NIL);
        lib.set("tmpname", LuaValue.NIL);
    }

    returned.set("load", LuaValue.NIL);
    returned.set("loadfile", LuaValue.NIL);
    returned.set("collectgarbage", LuaValue.NIL);

    returned.set("debug", LuaValue.NIL);
    returned.set("package", LuaValue.NIL);

    return returned;
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:51,代码来源:ScriptManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ISaveContext类代码示例发布时间:2022-05-22
下一篇:
Java IGuiLexiconEntry类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap