GetValue() public method

public GetValue ( int Index ) : Value
Index int
return Value
Example #1
0
        public Value Insert(List Arguments)
        {
            Value first = Arguments.GetValue(0);
            int   index;

            if (first is Number)
            {
                index = (int)((first as Number).Val);
            }
            else
            {
                throw new Exception("First parameter must be a number");
            }

            var second = Arguments.GetValue(1);

            if (index >= 0 && index < Arr.Count)
            {
                Arr.Insert(index, new Reference(second));
            }
            else
            {
                throw new Exception("Index is out of bounds");
            }
            return(this);
        }
Example #2
0
 public Value Ceiling(List Arguments)
 {
     if (Arguments.GetValue(0) is Number)
     {
         return(new Number(Math.Ceiling(((Number)Arguments.GetValue(0)).Val)));
     }
     throw new Exception("Ceiling function takes only a number");
 }
Example #3
0
 public Value Floor(List Arguments)
 {
     if (Arguments.GetValue(0) is Number)
     {
         return(new Number(Math.Floor(((Number)Arguments.GetValue(0)).Val)));
     }
     throw new Exception("Floor function takes only a number");
 }
Example #4
0
 public Value RemoveAt(List Arguments)
 {
     for (int i = 0; i < Arguments.Arr.Count; i++)
     {
         Value value = Arguments.GetValue(i);
         if (value is Number)
         {
             var index = (int)(value as Number).Val;
             Arr.RemoveAt(index);
         }
     }
     return(this);
 }
Example #5
0
 public Value Tan( List Arguments )
 {
     if ( Arguments.GetValue( 0 ) is Number )
         return new Number( Math.Tan( ( (Number)Arguments.GetValue( 0 ) ).Val ) );
     throw new Exception( "Tan function takes only a number" );
 }