예제 #1
0
 /// <summary>
 /// Equivalent to luaK_codeABC. </summary>
 internal int kCodeABC(int o, int a, int b, int c)
 {
     // assert getOpMode(o) == iABC;
     // assert getBMode(o) != OP_ARG_N || b == 0;
     // assert getCMode(o) != OP_ARG_N || c == 0;
     return(kCode(Lua.CREATE_ABC(o, a, b, c), ls.lastline()));
 }
예제 #2
0
        private bool patchtestreg(int node, int reg)
        {
            int i = getjumpcontrol(node);

            int[] code  = f.code_Renamed;
            int   instr = code[i];

            if (Lua.OPCODE(instr) != Lua.OP_TESTSET)
            {
                return(false);  // cannot patch other instructions
            }
            if (reg != Lua.NO_REG && reg != Lua.ARGB(instr))
            {
                code[i] = Lua.SETARG_A(instr, reg);
            }
            else     // no register to put value or register already has the value
            {
                code[i] = Lua.CREATE_ABC(Lua.OP_TEST, Lua.ARGB(instr), 0, Lua.ARGC(instr));
            }

            return(true);
        }