public Delegate(string name, MethodInfo methodInfo) : base(name) { Method = methodInfo; ParameterInfo[] parameters = methodInfo.GetParameters(); string[] parameterNames = new string[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { parameterNames[i] = parameters[i].Name; } SetParameters(parameterNames); // Set up the callback to our Method FuncImpl.Add(new Invocation(methodInfo, GetParameters())); // Reset the current scope to be the parent of this script command's scope CelesteStack.CurrentScope = FunctionScope.ParentScope; }
public static void RegisterFunction(string funcName, Type[] parameterTypes, FuncImpl body) { functions.Add(funcName.ToLower(), new FuncRegistryValue(body, parameterTypes)); }
public FuncRegistryValue(FuncImpl body, Type[] parameterTypes) { this.body = body; this.parameterTypes = parameterTypes; }