예제 #1
0
        /// <summary>
        /// Performs a binary arithmetic operation and returns the result.
        /// </summary>
        /// <param name="type">The type of operation to perform.</param>
        /// <param name="self">The first value to use.</param>
        /// <returns>The result of the operation.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// If the operation cannot be performed with the given values.
        /// </exception>
        /// <exception cref="System.InvalidArgumentException">
        /// If the argument is an invalid value.
        /// </exception>
        public override ILuaValue Arithmetic(BinaryOperationType type, LuaString self)
        {
            var t = self.ToNumber();

            if (t != null)
            {
                return(Arithmetic(type, t));
            }
            else
            {
                throw new InvalidOperationException(Errors.CannotArithmetic(LuaValueType.String));
            }
        }
예제 #2
0
 /// <summary>
 /// Performs a binary arithmetic operation and returns the result.
 /// </summary>
 /// <param name="type">The type of operation to perform.</param>
 /// <param name="self">The first value to use.</param>
 /// <returns>The result of the operation.</returns>
 /// <exception cref="System.InvalidOperationException">
 /// If the operation cannot be performed with the given values.
 /// </exception>
 /// <exception cref="System.InvalidArgumentException">
 /// If the argument is an invalid value.
 /// </exception>
 ILuaValue ILuaValueVisitor.Arithmetic(BinaryOperationType type, LuaString self)
 {
     throw new InvalidOperationException(Errors.CannotArithmetic(LuaValueType.String));
 }
예제 #3
0
 public ILuaValue ArithmeticFrom(BinaryOperationType type, LuaString self)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 /// <summary>
 /// Performs a binary arithmetic operation and returns the result.
 /// </summary>
 /// <param name="type">The type of operation to perform.</param>
 /// <param name="self">The first value to use.</param>
 /// <returns>The result of the operation.</returns>
 /// <exception cref="System.InvalidOperationException">
 /// If the operation cannot be performed with the given values.
 /// </exception>
 /// <exception cref="System.InvalidArgumentException">
 /// If the argument is an invalid value.
 /// </exception>
 public override ILuaValue Arithmetic(BinaryOperationType type, LuaString self)
 {
     return(self.Arithmetic(type, values_[0]));
 }
예제 #5
0
 /// <summary>
 /// Performs a binary arithmetic operation and returns the result.
 /// </summary>
 /// <param name="type">The type of operation to perform.</param>
 /// <param name="self">The first value to use.</param>
 /// <returns>The result of the operation.</returns>
 /// <exception cref="System.InvalidOperationException">
 /// If the operation cannot be performed with the given values.
 /// </exception>
 /// <exception cref="System.InvalidArgumentException">
 /// If the argument is an invalid value.
 /// </exception>
 public virtual ILuaValue Arithmetic(BinaryOperationType type, LuaString self)
 {
     throw new InvalidOperationException(Errors.CannotArithmetic(LuaValueType.String));
 }