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


Java Globals.set方法代码示例

本文整理汇总了Java中org.luaj.vm2.Globals.set方法的典型用法代码示例。如果您正苦于以下问题:Java Globals.set方法的具体用法?Java Globals.set怎么用?Java Globals.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.luaj.vm2.Globals的用法示例。


在下文中一共展示了Globals.set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAllTo

import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
 * Set all key-value pairs to lua globals
 */
public void setAllTo(Globals globals) {
    for (Map.Entry<String, Object> entry : entrySet()) {
        final Object value = entry.getValue();

        if (value instanceof Integer) {
            globals.set(entry.getKey(), (Integer) entry.getValue());
        } else if (value instanceof Long) {
            globals.set(entry.getKey(), (Long) entry.getValue());
        } else if (value instanceof Float) {
            globals.set(entry.getKey(), (Float) entry.getValue());
        } else if (value instanceof Double) {
            globals.set(entry.getKey(), (Double) entry.getValue());
        } else if (value instanceof String) {
            globals.set(entry.getKey(), (String) entry.getValue());
        } else if (value instanceof Byte) {
            globals.set(entry.getKey(), (Byte) entry.getValue());
        } else if (value instanceof Boolean) {
            globals.set(entry.getKey(), (Boolean) entry.getValue() ? LuaValue.TRUE : LuaValue.FALSE);
        }
    }
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:25,代码来源:UserConfig.java

示例2: main

import org.luaj.vm2.Globals; //导入方法依赖的package包/类
public static void main(String[] args) {
        Globals globals = JsePlatform.debugGlobals();
        globals.set("Core", new LuaTable());
        globals.get("Core").set("createEntityTemplate", new CreateEntityTemplate());
        globals.get("Core").set("invoke", new Invoke());
        globals.get("Core").set("destroy", new CreateEntityTemplate());
        
        ScriptableComponent cmp = new ScriptableComponent();
        
        File scripts = new File("scripts/");
        
        List<File> files = getFilesRec(scripts);
        for (File f : files) {
            if (f.getName().equals("autorun.lua")) globals.loadfile(f.getAbsolutePath()).call();
        }
//        cmp.initMethods();
        
//        cmp.awake();
        
//        cmp.setEnabled(true);
        
//        cmp.executeMethod(Events.CollisionEnter);
    }
 
开发者ID:AlexMog,项目名称:SurvivalMMO,代码行数:24,代码来源:TestScripts.java

示例3: luaMain

import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/** Simple wrapper for invoking a lua function with command line arguments.
 * The supplied function is first given a new Globals object,
 * then the program is run with arguments.
 */
public static void luaMain(LuaValue mainChunk, String[] args) {
    Globals g = standardGlobals();
    int n = args.length;
    LuaValue[] vargs = new LuaValue[args.length];
    for (int i = 0; i < n; ++i)
        vargs[i] = LuaValue.valueOf(args[i]);
    LuaValue arg = LuaValue.listOf(vargs);
    arg.set("n", n);
    g.set("arg", arg);
    mainChunk.initupvalue1(g);
    mainChunk.invoke(LuaValue.varargsOf(vargs));
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:17,代码来源:JsePlatform.java

示例4: getLocalCompiler

import org.luaj.vm2.Globals; //导入方法依赖的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

示例5: luaMain

import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
 * Simple wrapper for invoking a lua function with command line arguments.
 * The supplied function is first given a new Globals object,
 * then the program is run with arguments.
 */
public static void luaMain(LuaValue mainChunk, String[] args) {
    Globals g = standardGlobals();
    int n = args.length;
    LuaValue[] vargs = new LuaValue[args.length];
    for (int i = 0; i < n; ++i)
        vargs[i] = LuaValue.valueOf(args[i]);
    LuaValue arg = LuaValue.listOf(vargs);
    arg.set("n", n);
    g.set("arg", arg);
    mainChunk.initupvalue1(g);
    mainChunk.invoke(LuaValue.varargsOf(vargs));
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:18,代码来源:JsePlatform.java

示例6: setAllTo

import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
 * Set all key-value pairs to lua globals
 */
public void setAllTo(Globals globals) {
    globals.set("ID", id);
    globals.set("NAME", name);
    globals.set("TYPE", type);
    globals.set("VERSION", version);
    globals.set("ENTRY", entry);
    globals.set("DEBUG", debug ? LuaValue.TRUE : LuaValue.FALSE);
    userConfig.setAllTo(globals);
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:13,代码来源:Hub.java

示例7: luaMain

import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/** Simple wrapper for invoking a lua function with command line arguments.  
 * The supplied function is first given a new Globals object, 
 * then the program is run with arguments.
 */
public static void luaMain(LuaValue mainChunk, String[] args) {
	Globals g = standardGlobals();
	int n = args.length;
	LuaValue[] vargs = new LuaValue[args.length];
	for (int i = 0; i < n; ++i)
		vargs[i] = LuaValue.valueOf(args[i]);
	LuaValue arg = LuaValue.listOf(vargs);
	arg.set("n", n);
	g.set("arg", arg);
	mainChunk.initupvalue1(g);
	mainChunk.invoke(LuaValue.varargsOf(vargs));
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:17,代码来源:JsePlatform.java


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