public void SetParameters(Parameter[] pars) { this.pars = new Dictionary<String, Parameter>(); int count = 0; foreach (Parameter p in pars) { this.pars.Add(p.Name, p); p.Position = count++; } parsArr = pars; }
//For use with already-defined functions, like Console.WriteLine. Allows you to alias them for use inside the language. public Function(String funcName, MethodInfo mi) { fns.Add(funcName, this); this.mi = mi; ec = new ExecutionContext(null); var parInfos = mi.GetParameters(); Parameter[] pars = new Parameter[parInfos.Length]; for (int i = 0; i < pars.Length; i++) pars[i] = new Parameter(parInfos[i].ParameterType, parInfos[i].Name); ec.SetParameters(pars); }