Esempio n. 1
0
        /// <summary>
        /// 二元操作符操作指令,b代表操作数1索引,c代表操作数2索引,a代表结果寄存器索引
        /// </summary>
        /// <param name="i"></param>
        /// <param name="opType"></param>
        public void DoubleOperator(Instruction i, TokenType opType)
        {
            int a = 0, b = 0, c = 0;

            i.ABC(ref a, ref b, ref c);
            //将指定操作数传入栈顶
            luaState.GetRK(b);
            luaState.GetRK(c);
            //运算
            luaState.MathOperation(opType);
            //将结果传送到指定寄存器
            luaState.Replace(a + 1);
        }