</head> <body> <h1>Func Object <span class="ver">[v1.1.00+]</span></h1> <p>Represents a user-defined or built-in function which can be called by the script. <a href="../commands/Func.htm">Func</a> returns an object of this type.</p> <p>For information about other objects which can be called like functions, see <a href="Functor.htm">Function Objects</a>.</p> <p>A reference to a Func object is also known as a <em>function reference</em>. To retrieve a function reference, use the Func function as in the following example:</p> <pre><em>; Retrieve a reference to the function named "StrLen".</em> fn := Func("StrLen") <em>; Display information about the function.</em> MsgBox % fn.Name "() is " (fn.IsBuiltIn ? "built-in." : "user-defined.")</pre> <h2 id="toc">Table of Contents</h2> <ul class="indent"> <li><a href="#Methods">Methods</a>: <ul> <li><a href="#Call">Call</a>: Calls the function.</li> <li><a href="#Bind">Bind</a>: Binds parameters to the function and returns a <a href="Functor.htm#BoundFunc">BoundFunc object</a>.</li> <li><a href="#IsByRef">IsByRef</a>: Determines whether a parameter is ByRef.</li> <li><a href="#IsOptional">IsOptional</a>: Determines whether a parameter is optional.</li> </ul> </li> <li><a href="#Properties">Properties</a>: <ul> <li><a href="#Name">Name</a>: Returns the function's name.</li> <li><a href="#IsBuiltIn">IsBuiltIn</a>: Returns <i>true</i> if the function is <a href="../Functions.htm#BuiltIn">built-in</a> and <i>false</i> otherwise.</li> <li><a href="#IsVariadic">IsVariadic</a>: Returns <i>true</i> if the function is <a href="../Functions.htm#Variadic">variadic</a> and <i>false</i> otherwise.</li> <li><a href="#MinParams">MinParams</a>: Returns the number of required parameters.</li> <li><a href="#MaxParams">MaxParams</a>: Returns the number of formally-declared parameters for a user-defined function or maximum parameters for a built-in function.</li> </ul> </li> </ul> <h2 id="Methods">Methods</h2> <div class="methodShort" id="Call"><h3>Call</h3> <p>Calls the function.</p> <pre class="Syntax"> Func.<span class="func">Call</span>(Param1, Param2, ...) <em>; Requires <span class="ver">[v1.1.19+]</span></em> Func.(Param1, Param2, ...) <em>; Old form - deprecated</em> </pre> <dl> <dt>Param1, Param2, ...</dt> <dd>Parameters and return value are defined by the function.</dd> </dl> <p><span class="ver">[v1.1.07+]:</span> <code><a href="../Functions.htm#DynCall">%Func%()</a></code> can be used to call a function by name or reference, or to call an object which implements the __Call <a href="../Objects.htm#Meta_Functions">meta-function</a>. This should be used instead of <code>Func.()</code> wherever possible.</p> </div> <div class="methodShort" id="Bind"><h3>Bind <span class="ver">[v1.1.20+]</span></h3> <p>Binds parameters to the function and returns a <a href="Functor.htm#BoundFunc">BoundFunc object</a>.</p> <pre class="Syntax">BoundFunc := Func.<span class="func">Bind</span>(Param1, Param2, ...)</pre> <dl> <dt>Param1, Param2, ...</dt> <dd>Any number of parameters.</dd> </dl> <p>For details and examples, see <a href="Functor.htm#BoundFunc">BoundFunc object</a>.</p> </div> <div class="methodShort" id="IsByRef"><h3>IsByRef</h3> <p>Determines whether a parameter is ByRef.</p> <pre class="Syntax">Boolean := Func.<span class="func">IsByRef</span>(<span class="optional">ParamIndex</span>)</pre> <dl> <dt>ParamIndex</dt> <dd>Optional: the one-based index of a parameter. If omitted, <em>Boolean</em> indicates whether the function has any ByRef parameters.</dd> </dl> <p>Returns an empty string if the function is built-in or <i>ParamIndex</i> is invalid; otherwise, a boolean value indicating whether the parameter is ByRef.</p> </div> <div class="methodShort" id="IsOptional"><h3>IsOptional</h3> <p>Determines whether a parameter is optional.</p> <pre class="Syntax">Boolean := Func.<span class="func">IsOptional</span>(<span class="optional">ParamIndex</span>)</pre> <dl> <dt>ParamIndex</dt> <dd>Optional: the one-based index of a parameter. If omitted, <em>Boolean</em> indicates whether the function has any optional parameters.</dd> </dl> <p>Returns an empty string if <i>ParamIndex</i> is invalid; otherwise, a boolean value indicating whether the parameter is optional.</p> <p>Parameters do not need to be formally declared if the function is variadic. Built-in functions are supported.</p></div> <h2 id="Properties">Properties</h2> <div class="methodShort" id="Name"><h3>Name</h3> <p>Returns the function's name.</p> <pre class="Syntax">FunctionName := Func.Name</pre> </div> <div class="methodShort" id="IsBuiltIn"><h3>IsBuiltIn</h3> <p>Returns <i>true</i> if the function is <a href="../Functions.htm#BuiltIn">built-in</a> and <i>false</i> otherwise.</p> <pre class="Syntax">Boolean := Func.IsBuiltIn</pre> </div> <div class="methodShort" id="IsVariadic"><h3>IsVariadic</h3> <p>Returns <i>true</i> if the function is <a href="../Functions.htm#Variadic">variadic</a> and <i>false</i> otherwise.</p> <pre class="Syntax">Boolean := Func.IsVariadic</pre> </div> <div class="methodShort" id="MinParams"><h3>MinParams</h3> <p>Returns the number of required parameters.</p> <pre class="Syntax">ParamCount := Func.MinParams</pre> </div> <div class="methodShort" id="MaxParams"><h3>MaxParams</h3> <p>Returns the number of formally-declared parameters for a user-defined function or maximum parameters for a built-in function.</p> <pre class="Syntax">ParamCount := Func.MaxParams</pre> <p>If the function is <a href="../Functions.htm#Variadic">variadic</a>, <em>ParamCount</em> indicates the maximum number of parameters which can be accepted by the function without overflowing into the "variadic*" parameter.</p></div> </body> </html>