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


Java JsePlatform.debugGlobals方法代码示例

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


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

示例1: setupGlobals

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
/**
 * setup global values
 *
 * @param globals
 */
private static Globals setupGlobals(Globals globals) {
    if (globals != null) {
        if (LuaViewConfig.isOpenDebugger()) {
            JsePlatform.debugGlobals(globals);
        } else {
            JsePlatform.standardGlobals(globals);//加载系统libs TODO 性能瓶颈
        }

        if (LuaViewConfig.isUseLuaDC()) {
            LuaDC.install(globals);
        }
        loadLuaViewLibs(globals);//加载用户lib TODO 性能瓶颈
        globals.isInited = true;
    }
    return globals;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:22,代码来源:LuaViewManager.java

示例2: main

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的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: completed

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
public void completed(String message, SocketReader socketReader) throws IOException {
    final int valueSize = Integer.parseInt(message);
    final String valueString = socketReader.readBytes(valueSize);

    log.debug("Read value: " + valueString);
    try {
        Globals globals = JsePlatform.debugGlobals();
        LuaValue chunk = globals.load(valueString);
        LuaTable stackDump = chunk.call().checktable();  // Executes the chunk and returns it
        LuaRemoteStack.clearIdKey(stackDump);
        LuaValue rawValue = stackDump;
        if (stackDump.keyCount() == 1)
            rawValue = stackDump.get(1);
        else if (stackDump.keyCount() == 0)
            rawValue = LuaValue.NIL;
        LuaDebugValue value = new LuaDebugValue(rawValue, AllIcons.Debugger.Watch);
        myPromise.setResult(value);
    } catch (LuaError e) {
        LuaDebugValue errorValue = new LuaDebugValue(
                "error",
                "Error during evaluation: " + e.getMessage(),
                AllIcons.Nodes.ErrorMark
        );
        myPromise.setResult(errorValue);
    }
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:27,代码来源:LuaDebuggerController.java

示例4: makeGlobals

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的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: create

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
public static LuaRemoteStack create(String code) {
    Globals globals = JsePlatform.debugGlobals();
    LuaValue chunk = globals.load(code);
    LuaTable stackDump = chunk.call().checktable();
    clearIdKey(stackDump);
    return new LuaRemoteStack(stackDump);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:8,代码来源:LuaRemoteStack.java

示例6: init

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
public static Globals init() {
    if(g == null) {
        LuaMesh.debug = System.out::println;
        register("ObjectFields");
        register("ObjectLibraries");
        register("ObjectMethods");
        register("ObjectNames");
        register("UnidirectionalDelegate");
        LuaMesh.register(UnidirectionalTarget.class, name -> {
            switch(name) {
                case "doThings": return "doStuff";
                default: return name;
            }
        });

        try {
            LuaMesh.init();
        } catch(Throwable any) {
            any.printStackTrace();
            Assert.fail("Initialization failed.");
        }

        g = JsePlatform.debugGlobals();
        g.set("ctype", new FunctionCType());
    }

    return g;
}
 
开发者ID:Xemiru,项目名称:LuaMesh,代码行数:29,代码来源:Utility.java

示例7: runFragment

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
public void runFragment( Varargs expected, String script ) {
	try {
		String name = getName();
		Globals globals = JsePlatform.debugGlobals();
		Reader reader = new StringReader(script);
		LuaValue chunk ;
		switch ( TEST_TYPE ) {
		case TEST_TYPE_LUAJC:
			LuaJC.install(globals);
			chunk = globals.load(reader, name);
			break;
		default:
			Prototype p = globals.compilePrototype(reader, name);
			chunk = new LuaClosure(p, globals);
			Print.print(p);
			break;
		}
		Varargs actual = chunk.invoke();
		assertEquals( expected.narg(), actual.narg() );
		for ( int i=1; i<=actual.narg(); i++ )
			assertEquals( expected.arg(i), actual.arg(i) );
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		fail(e.toString());
	}		
}
 
开发者ID:gnosygnu,项目名称:luaj_xowa,代码行数:28,代码来源:FragmentsTest.java

示例8: compile

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
@Override
protected void compile()
{
	if(globals == null) globals = JsePlatform.debugGlobals();
	globals.set("require", new RequireFunction(scriptResource, globals));
	globals.set("print", new PrintFunction(globals));
	globals.load(new EngineLib());
	globals.load(scriptSource, scriptResource.getResourceLocation().getName()).call();
}
 
开发者ID:jglrxavpok,项目名称:jglrEngine,代码行数:10,代码来源:LuaScript.java

示例9: LuaVM

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
public LuaVM(boolean debug)
{	
	_G = debug ? JsePlatform.debugGlobals() : JsePlatform.standardGlobals();

	// Global libraries
	_G.load(new MappingLib());
	_G.load(new RemapperLib());
	_G.load(new FSLib());
	_G.load(new HTTPLib());
	_G.load(new ZipLib());
	
	// Load-on-demand libraries
	_G.load(new ProfilerLib());
	
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:16,代码来源:LuaVM.java

示例10: setup

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
@Before
public void setup() {
	globals = JsePlatform.debugGlobals();
	BaseLib.FINDER = this;
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:6,代码来源:StringLibTest.java

示例11: getGlobals

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
protected static LuaTable getGlobals() {
	return JsePlatform.debugGlobals();
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:4,代码来源:PerformanceRunner.java

示例12: setup

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
@Before
public void setup() {
	globals = JsePlatform.debugGlobals();
}
 
开发者ID:SquidDev,项目名称:luaj.luajc,代码行数:5,代码来源:PerformanceCompile.java

示例13: LuajContext

import org.luaj.vm2.lib.jse.JsePlatform; //导入方法依赖的package包/类
/** Construct a LuajContext with its own globals, which
 * which optionally are debug globals, and optionally use the
 * luajc direct lua to java bytecode compiler.
 * <p>
 * If createDebugGlobals is set, the globals
 * created will be a debug globals that includes the debug 
 * library.  This may provide better stack traces, but may 
 * have negative impact on performance.
 * @param createDebugGlobals true to create debug globals, 
 * false for standard globals.
 * @param useLuaJCCompiler true to use the luajc compiler, 
 * reqwuires bcel to be on the class path.
 */
public LuajContext(boolean createDebugGlobals, boolean useLuaJCCompiler) {
	globals = createDebugGlobals?
   		JsePlatform.debugGlobals():
   		JsePlatform.standardGlobals();
   	if (useLuaJCCompiler)
   		LuaJC.install(globals);
   	stdin = globals.STDIN;
   	stdout = globals.STDOUT;
   	stderr = globals.STDERR;
}
 
开发者ID:gnosygnu,项目名称:luaj_xowa,代码行数:24,代码来源:LuajContext.java


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