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


Java LuaC类代码示例

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


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

示例1: standardGlobals

import org.luaj.vm2.compiler.LuaC; //导入依赖的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.compiler.LuaC; //导入依赖的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.compiler.LuaC; //导入依赖的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.compiler.LuaC; //导入依赖的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.compiler.LuaC; //导入依赖的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.compiler.LuaC; //导入依赖的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: processScript

import org.luaj.vm2.compiler.LuaC; //导入依赖的package包/类
private static void processScript(InputStream script, String chunkname, OutputStream out) throws IOException
{
	try
	{
		// create the chunk
		Prototype chunk = LuaC.compile(script, chunkname);

		// list the chunk
		if(list)
		    Print.printCode(System.out, chunk);

		// write out the chunk
		if(!parseonly)
		{
			DumpState.dump(chunk, out, stripdebug, numberformat, littleendian);
		}
	}
	catch(Exception e)
	{
		e.printStackTrace(System.err);
	}
	finally
	{
		script.close();
	}
}
 
开发者ID:dwing4g,项目名称:luaj,代码行数:27,代码来源:luac.java

示例8: processScript

import org.luaj.vm2.compiler.LuaC; //导入依赖的package包/类
private static void processScript(InputStream script, String chunkname, String[] args, int firstarg)
{
	try
	{
		LuaFunction c;
		try
		{
			c = LuaC.load(script, chunkname, _G);
		}
		finally
		{
			script.close();
		}
		Varargs scriptargs = (args != null ? setGlobalArg(args, firstarg) : LuaValue.NONE);
		c.invoke(scriptargs);
	}
	catch(Exception e)
	{
		e.printStackTrace(System.err);
	}
}
 
开发者ID:dwing4g,项目名称:luaj,代码行数:22,代码来源:lua.java

示例9: LuaEngine

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

示例10: loadSkeletalAnimation

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

示例11: standardGlobals

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

示例12: standardGlobals

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

示例13: newStandard

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

示例14: initEnvironment

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

示例15: ScriptingManager

import org.luaj.vm2.compiler.LuaC; //导入依赖的package包/类
public ScriptingManager(File scriptDirectory, StrictModeOption strictMode) {
    this.scriptDirectory = scriptDirectory;
    modules = new HashMap<>();
    this.strictMode = strictMode;
    globals = createGlobals();
    LuaC.install(globals);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:8,代码来源:ScriptingManager.java


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