Esempio n. 1
0
        public static Value invokeBuiltInFunction(BuiltInFunction function, params object[] arguments)
        {
            List <Value> value_args = new List <Value>();

            foreach (object arg in arguments)
            {
                if (arg.GetType() == typeof(string))
                {
                    value_args.Add(new Value((string)arg));
                }
                else if (arg.GetType() == typeof(char))
                {
                    value_args.Add(new Value((char)arg));
                }
                else if (arg.GetType() == typeof(int))
                {
                    value_args.Add(new Value((double)arg));
                }
                else if (arg.GetType() == typeof(double))
                {
                    value_args.Add(new Value((double)arg));
                }
                else if (arg == null)
                {
                    value_args.Add(null);
                }
                else
                {
                    throw new Exception("Invalid Value type.");
                }
            }
            return(function.Invoke(new List <Value>(value_args)));
        }
Esempio n. 2
0
 public static Value invokeBuiltInFunction(BuiltInFunction function, params Value[] arguments)
 {
     return(function.Invoke(new List <Value>(arguments)));
 }