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


Java LoadState.install方法代码示例

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


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

示例1: standardGlobals

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
     * Create a standard set of globals for JSE including all the libraries.
     *
     * @return Table of globals initialized with the standard JSE libraries
     * @see #debugGlobals()
     * @see JsePlatform
     * @see JmePlatform
     */
    public static Globals 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 JseOsLib());
//		globals.load(new JseIoLib());//安全考虑,删除for LuaView
//		globals.load(new LuajavaLib());//安全考虑,删除for LuaView
        LoadState.install(globals);
        LuaC.install(globals);
        return globals;
    }
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:25,代码来源:JsePlatform.java

示例2: main

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

示例3: setupCompilerGlobal

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

示例4: standardGlobals

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
 * Create a standard set of globals for JSE including all the libraries.
 * 
 * @return Table of globals initialized with the standard JSE libraries
 * @see #debugGlobals()
 * @see JsePlatform
 * @see org.luaj.vm2.lib.jme.JmePlatform
 */
public static Globals 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 LuajavaLib());
	LoadState.install(globals);
	LuaC.install(globals);
	return globals;		
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:25,代码来源:JsePlatform.java

示例5: LuaScriptExecutorPool

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

示例6: standardGlobals

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
 * Create a standard set of globals for JSE including all the libraries.
 * 
 * @return Table of globals initialized with the standard JSE libraries
 * @see #debugGlobals()
 * @see JsePlatform
 * @see JmePlatform
 */
public static Globals 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 LuajavaLib());
	LoadState.install(globals);
	LuaC.install(globals);
	return globals;		
}
 
开发者ID:Cephrus,项目名称:Elite-Armageddon,代码行数:25,代码来源:JsePlatform.java

示例7: LuaEngine

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

示例8: loadSkeletalAnimation

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
private static void loadSkeletalAnimation(Animation animation, File animationFile) throws IOException
{
    Globals globals = new Globals();
    globals.load(new PackageLib());
    globals.load(new JseMathLib());
    LoadState.install(globals);
    LuaC.install(globals);
    
    LuaValue chunk = globals.load(new FileReader(animationFile), "SkeletalAnimation");
    chunk.call();

    LuaTable rootT = globals.get("root").checktable();
    LuaTable animationT = globals.get("animation").checktable();

    loadAnimation(animation, animationT, rootT);
    animation.root = loadBone(animation, rootT);
}
 
开发者ID:LoDoMa,项目名称:Lime,代码行数:18,代码来源:AnimationLoader.java

示例9: standardGlobals

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
 * Create a standard set of globals for JME including all the libraries.
 * 
 * @return Table of globals initialized with the standard JME libraries
 * @see #debugGlobals()
 * @see JsePlatform
 * @see JmePlatform
 */
public static Globals standardGlobals() {
	Globals globals = new Globals();
	globals.load(new BaseLib());
	globals.load(new PackageLib());
	globals.load(new Bit32Lib());
	globals.load(new OsLib());
	globals.load(new MathLib());
	globals.load(new TableLib());
	globals.load(new StringLib());
	globals.load(new CoroutineLib());
	globals.load(new JmeIoLib());
	LoadState.install(globals);
	LuaC.install(globals);
	return globals;		
}
 
开发者ID:gnosygnu,项目名称:luaj_xowa,代码行数:24,代码来源:JmePlatform.java

示例10: standardGlobals

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
 * Create a standard set of globals for JSE including all the libraries.
 *
 * @return Table of globals initialized with the standard JSE libraries
 * @see #debugGlobals()
 * @see org.luaj.vm2.lib.jse.JsePlatform
 * @see org.luaj.vm2.lib.jme.JmePlatform
 */
public static Globals 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 JseMathLib());
    globals.load(new JseOsLib());
    LoadState.install(globals);
    LuaC.install(globals);
    return globals;
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:22,代码来源:JsePlatform.java

示例11: newStandard

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

示例12: initEnvironment

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
private void initEnvironment() {
	environment = new Globals();
	
	LoadState.install(environment);
	LuaC.install(environment);
	LuaJC.install(environment);
	
	modsTable = new LuaTable();
	environment.set("mods", modsTable);
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:11,代码来源:LuaEnvironment.java

示例13: installRuntime

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
public static void installRuntime() {
    LoadState.install(GLOBAL_PATH);
    LuaC.install(GLOBAL_PATH);
}
 
开发者ID:LukkitPlus,项目名称:Lukkit,代码行数:5,代码来源:Environment.java

示例14: fromLua

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
/**
 * Create hub from a lua script text
 */
public static Hub fromLua(String luaText) throws Exception {
    // Obatain a lua globals for loading configs
    final Globals globals = new Globals();
    LoadState.install(globals);
    LuaC.install(globals);

    final Hub hub = new Hub();
    globals.load(luaText).call();

    Varargs pair;
    LuaValue key = LuaValue.NIL;
    LuaValue value;
    String keyStr;
    while (true) {
        pair = globals.next(key);
        if ((key = pair.arg1()).isnil())
            break;

        value = pair.arg(2);
        keyStr = key.checkjstring();
        switch (keyStr) {
            case "ID":
                hub.setId(value.checkjstring().toLowerCase());
                break;

            case "NAME":
                hub.setName(value.checkjstring());
                break;

            case "TYPE":
                final String type = value.checkjstring();
                boolean isTypeSupported = false;
                for (String supportedType : SUPPORTED_TYPES) {
                    if (supportedType.equalsIgnoreCase(type)) {
                        isTypeSupported = true;
                        break;
                    }
                }

                if (isTypeSupported) {
                    hub.setType(type);
                } else {
                    throw new Exception("Not supported hub type.");
                }
                break;

            case "VERSION":
                hub.setVersion(value.checkjstring());
                break;

            case "ENTRY":
                hub.setEntry(value.checkjstring());
                break;

            case "DEBUG":
                hub.setDebug(value.checkboolean());
                break;

            default:
                hub.userConfig.put(keyStr, value);
                break;
        }
    }

    hub.checkProperties();

    return hub;
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:72,代码来源:Hub.java

示例15: onCreate

import org.luaj.vm2.LoadState; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StateSaver.restoreInstanceState(this, savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_hub_config);
    mHubManager = HubsApplication.getDefaultHubManager(this);

    /*
      Data initialize
     */
    if (mHub == null) {
        mHub = getIntent().getParcelableExtra("hub");
        // Add name config
        mHub.getUserConfig().put("NAME", mHub.getName());

        mPropertyVOs = listOf(mHub);
    }

    // Setup lua globals
    LoadState.install(mGlobals);
    LuaC.install(mGlobals);
    mHub.setAllTo(mGlobals);

    /*
      View initialize
     */
    setSupportActionBar(mBinding.toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayShowHomeEnabled(true);
    }

    // Setup the recyclerview
    mAdapter = new ConfigPropertyListAdapter(mPropertyVOs);
    mAdapter.setUIEventListener(this);

    mBinding.recyclerView.setLayoutManager(
            new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    mBinding.recyclerView.setAdapter(mAdapter);
    mBinding.recyclerView.setItemAnimator(null);
    mBinding.recyclerView.addItemDecoration(DividerItemDecoration.obtainDefault(this));
    mBinding.getRoot().setFocusableInTouchMode(true);
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:43,代码来源:HubConfigActivity.java


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