Beispiel #1
0
        private static double O_Arith(LuaOp op, double v1, double v2)
        {
            switch (op)
            {
            case LuaOp.LUA_OPADD: return(v1 + v2);

            case LuaOp.LUA_OPSUB: return(v1 - v2);

            case LuaOp.LUA_OPMUL: return(v1 * v2);

            case LuaOp.LUA_OPDIV: return(v1 / v2);

            case LuaOp.LUA_OPMOD: return(v1 % v2);

            case LuaOp.LUA_OPPOW: return(Math.Pow(v1, v2));

            case LuaOp.LUA_OPUNM: return(-v1);

            default: throw new System.NotImplementedException();
            }
        }
Beispiel #2
0
 private static double O_Arith( LuaOp op, double v1, double v2 )
 {
     switch( op )
     {
         case LuaOp.LUA_OPADD: return v1+v2;
         case LuaOp.LUA_OPSUB: return v1-v2;
         case LuaOp.LUA_OPMUL: return v1*v2;
         case LuaOp.LUA_OPDIV: return v1/v2;
         case LuaOp.LUA_OPMOD: return v1%v2;
         case LuaOp.LUA_OPPOW: return Math.Pow(v1, v2);
         case LuaOp.LUA_OPUNM: return -v1;
         default: throw new System.NotImplementedException();
     }
 }