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

Java LuaException类代码示例

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

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



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

示例1: initLuaContext

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
private void initLuaContext(LuaState luaState){
    try {
        JavaFunction logfunction = new LogFunctionCallBack(luaState);
        logfunction.register("log");
        JavaFunction tostringfunction = new ToStringFunctionCallBack(luaState);
        tostringfunction.register("tostring");
        JavaFunction bindfunction = new BindClassCallBack(luaState);
        bindfunction.register("bind");
        JavaFunction reflecttion = new ReflectCallBack(luaState);
        reflecttion.register("getMethod");
    } catch (LuaException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
 
开发者ID:CvvT,项目名称:AppTroy,代码行数:17,代码来源:LuaScriptInvoker.java


示例2: execute

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
@Override
public int execute() throws LuaException {
    int param_size = this.L.getTop();
    if (param_size == 2) {
        String clsName = this.L.getLuaObject(2).getString();
        try {
            Class<?> clazz = ModuleContext.getInstance().getBaseClassLoader().loadClass(clsName);
            this.L.pushJavaObject(clazz);
            return 1;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return 0;
        }
    }
    return 0;
}
 
开发者ID:CvvT,项目名称:AppTroy,代码行数:17,代码来源:LuaScriptInvoker.java


示例3: initLuaContext

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
private void initLuaContext(LuaState luaState){
	try {
		JavaFunction logfunction = new LogFunctionCallBack(luaState);
		logfunction.register("log");
		JavaFunction tostringfunction = new ToStringFunctionCallBack(luaState);
		tostringfunction.register("tostring");
		luaState.pushJavaObject(ModuleContext.getInstance().getAppContext().getApplicationContext());
		luaState.setGlobal("context");
		luaState.pushJavaObject(ZjDroidLuaJavaAPI.getInstance());
		luaState.setGlobal("zjdroid");
	} catch (LuaException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
}
 
开发者ID:mikusjelly,项目名称:HeyGirl,代码行数:17,代码来源:LuaScriptInvoker.java


示例4: main

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
public static void main(String[] args) throws LuaException {
		LuaState lua = LuaStateFactory.newLuaState();
		lua.openLibs();
		lua.pushJavaObject(new Thread() {
			public void run() {
				System.out.println("Lua Thread?");
			}
		});
		lua.setGlobal("t");
		int re = lua.LloadString("function f() t:run() return 123 end return f()");
		System.out.println(re);
		lua.pcall(0, 1, 0);
		System.out.println("re="+re);
		System.out.println(lua.getTop());
		System.out.println(lua.getLuaObject(1).getNumber());
		Lang.quiteSleep(2000);
//		System.out.println(System.currentTimeMillis());
	}
 
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:19,代码来源:WxManagerModule.java


示例5: initLuaContext

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
private void initLuaContext(LuaState luaState){
	try {
		JavaFunction logfunction = new LogFunctionCallBack(luaState);
		logfunction.register("log");
		JavaFunction tostringfunction = new ToStringFunctionCallBack(luaState);
		tostringfunction.register("tostring");
	} catch (LuaException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:13,代码来源:LuaScriptInvoker.java


示例6: execute

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	for(int i=2; i<=param_size; i++){
		try {
			String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
			Logger.log(objDsrc);
		} catch (Exception e) {
			e.printStackTrace();
		}				
	}
	return 0;
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:15,代码来源:LuaScriptInvoker.java


示例7: console

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
@At("/console/?")
@AdaptBy(type=VoidAdaptor.class)
@POST
@Ok("json")
public Object console(String openid, @Attr(value="usr", scope=Scope.SESSION)String usr,  InputStream in) throws LuaException {
	WxMpInfo master = (WxMpInfo) wxctx.get(openid);
	if (master == null || !usr.equals(master.getOwner())) {
		return new HttpStatusView(403);
	}
	WxAPI wxapi = wxctx.getAPI(openid);
	LuaState lua = sandbox(openid);
	try {
		String str = Streams.readAndClose(new InputStreamReader(in));
		lua.pushJavaObject(wxapi);
		lua.setGlobal("wxapi");
		lua.pushJavaObject(Wxs.class);
		lua.setGlobal("wxs");
		// "wxs = luajava.bindClass('org.nutz.weixin.util.Wxs')\n"+ 
		int re = lua.LloadString(str);
		if (re != 0) {
			return "lua error re="+re + ", msg=" + lua.getLuaObject(1);
		}
		lua.pcall(0, 1, 0);
		if (re != 0) {
			return "lua error re="+re + ", msg=" + lua.getLuaObject(1);
		}
		return LUAs.toJavaObject(lua.getLuaObject(1));
	} finally {
		lua.close();
	}
}
 
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:32,代码来源:WxManagerModule.java


示例8: toJavaObject

import org.keplerproject.luajava.LuaException; //导入依赖的package包/类
public static Object toJavaObject(LuaObject luaobj) throws LuaException {
	if (luaobj.isJavaObject()) {
		Object obj = luaobj.getObject();
		if (obj instanceof Throwable)
			Toolkit.log.info("lua Err?", (Throwable)obj);
		return luaobj.getObject();
	}
	if (luaobj.isJavaFunction()) {
		return "JavaFunction";
	}
	if (luaobj.isNil()) {
		return null;
	}
	if (luaobj.isNumber()) {
		return luaobj.getNumber();
	}
	if (luaobj.isBoolean()) {
		return luaobj.getBoolean();
	}
	if (luaobj.isString())
		return luaobj.getString();
	if (luaobj.isTable()) {
		return  "lua.table";
	}
	if (luaobj.isUserdata()) {
		return "lua.userdata";
	}
	if (luaobj.isFunction()) {
		return "lua.function";
	}
	throw Lang.noImplement();
}
 
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:33,代码来源:LUAs.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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