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


Java Lua.OP_ADD属性代码示例

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


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

示例1: precedence

static int precedence(int op) {
	switch ( op ) {
	case Lua.OP_OR: return 0;
	case Lua.OP_AND: return 1;
	case Lua.OP_LT: case Lua.OP_GT: case Lua.OP_LE: case Lua.OP_GE: case Lua.OP_NEQ: case Lua.OP_EQ: return 2;
	case Lua.OP_CONCAT: return 3;
	case Lua.OP_ADD: case Lua.OP_SUB: return 4;
	case Lua.OP_MUL: case Lua.OP_DIV: case Lua.OP_MOD: return 5;
	case Lua.OP_NOT: case Lua.OP_UNM: case Lua.OP_LEN: return 6;
	case Lua.OP_POW: return 7;
	default: throw new IllegalStateException("precedence of bad op "+op);
	}
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:13,代码来源:Exp.java

示例2: getfuncname

static NameWhat getfuncname(DebugLib.CallFrame frame) {
	if (!frame.f.isclosure())
		return new NameWhat(frame.f.classnamestub(), "Java");
	Prototype p = frame.f.checkclosure().p;
	int pc = frame.pc;
	int i = p.code[pc]; /* calling instruction */
	LuaString tm;
	switch (Lua.GET_OPCODE(i)) {
		case Lua.OP_CALL:
		case Lua.OP_TAILCALL: /* get function name */
			return getobjname(p, pc, Lua.GETARG_A(i));
		case Lua.OP_TFORCALL: /* for iterator */
	    	return new NameWhat("(for iterator)", "(for iterator");
	    /* all other instructions can call only through metamethods */
	    case Lua.OP_SELF:
	    case Lua.OP_GETTABUP:
	    case Lua.OP_GETTABLE: tm = LuaValue.INDEX; break;
	    case Lua.OP_SETTABUP:
	    case Lua.OP_SETTABLE: tm = LuaValue.NEWINDEX; break;
	    case Lua.OP_EQ: tm = LuaValue.EQ; break;
	    case Lua.OP_ADD: tm = LuaValue.ADD; break;
	    case Lua.OP_SUB: tm = LuaValue.SUB; break;
	    case Lua.OP_MUL: tm = LuaValue.MUL; break;
	    case Lua.OP_DIV: tm = LuaValue.DIV; break;
	    case Lua.OP_MOD: tm = LuaValue.MOD; break;
	    case Lua.OP_POW: tm = LuaValue.POW; break;
	    case Lua.OP_UNM: tm = LuaValue.UNM; break;
	    case Lua.OP_LEN: tm = LuaValue.LEN; break;
	    case Lua.OP_LT: tm = LuaValue.LT; break;
	    case Lua.OP_LE: tm = LuaValue.LE; break;
	    case Lua.OP_CONCAT: tm = LuaValue.CONCAT; break;
	    default:
	      return null;  /* else no useful name can be found */
	}
	return new NameWhat( tm.tojstring(), "metamethod" );
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:36,代码来源:DebugLib.java

示例3: binaryop

public void binaryop(int o) {
	String op;
	switch (o) {
		default: 
		case Lua.OP_ADD: op = "add"; break;
		case Lua.OP_SUB: op = "sub"; break;
		case Lua.OP_MUL: op = "mul"; break;
		case Lua.OP_DIV: op = "div"; break;
		case Lua.OP_MOD: op = "mod"; break;
		case Lua.OP_POW: op = "pow"; break;
	}
       append(factory.createInvoke(STR_LUAVALUE, op, TYPE_LUAVALUE, ARG_TYPES_LUAVALUE, Constants.INVOKEVIRTUAL));
}
 
开发者ID:gnosygnu,项目名称:luaj_xowa,代码行数:13,代码来源:JavaBuilder.java

示例4: getfuncname

static NameWhat getfuncname(DebugLib.CallFrame frame) {
    if (!frame.f.isclosure())
        return new NameWhat(frame.f.classnamestub(), "Java");
    Prototype p = frame.f.checkclosure().p;
    int pc = frame.pc;
    int i = p.code[pc]; /* calling instruction */
    LuaString tm;
    switch (Lua.GET_OPCODE(i)) {
        case Lua.OP_CALL:
        case Lua.OP_TAILCALL: /* get function name */
            return getobjname(p, pc, Lua.GETARG_A(i));
        case Lua.OP_TFORCALL: /* for iterator */
            return new NameWhat("(for iterator)", "(for iterator");
        /* all other instructions can call only through metamethods */
        case Lua.OP_SELF:
        case Lua.OP_GETTABUP:
        case Lua.OP_GETTABLE:
            tm = LuaValue.INDEX;
            break;
        case Lua.OP_SETTABUP:
        case Lua.OP_SETTABLE:
            tm = LuaValue.NEWINDEX;
            break;
        case Lua.OP_EQ:
            tm = LuaValue.EQ;
            break;
        case Lua.OP_ADD:
            tm = LuaValue.ADD;
            break;
        case Lua.OP_SUB:
            tm = LuaValue.SUB;
            break;
        case Lua.OP_MUL:
            tm = LuaValue.MUL;
            break;
        case Lua.OP_DIV:
            tm = LuaValue.DIV;
            break;
        case Lua.OP_MOD:
            tm = LuaValue.MOD;
            break;
        case Lua.OP_POW:
            tm = LuaValue.POW;
            break;
        case Lua.OP_UNM:
            tm = LuaValue.UNM;
            break;
        case Lua.OP_LEN:
            tm = LuaValue.LEN;
            break;
        case Lua.OP_LT:
            tm = LuaValue.LT;
            break;
        case Lua.OP_LE:
            tm = LuaValue.LE;
            break;
        case Lua.OP_CONCAT:
            tm = LuaValue.CONCAT;
            break;
        default:
            return null;  /* else no useful name can be found */
    }
    return new NameWhat(tm.tojstring(), "metamethod");
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:64,代码来源:DebugLib.java


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