IsCustomFunction
Description
Determines whether a name represents a custom function.
Returns
True, if name can be called as a custom function; False, otherwise.
Category
Decision functions
Function syntax
IsCustomFunction(name)
Parameters
Parameter
name
Usage
The
IsCustomFunction
function, including functions defined using CFScript
tags, and functions that are ColdFusion component methods. For CFC methods, you must first
instantiate the component.
Note: To prevent undefined variable exceptions, always precede IsCustomFunction with an
test, as shown in the example.
IsDefined
Example
<h3>IsCustomFunction Example</h3>
<cfscript>
function realUDF() {
return 1;
}
</cfscript>
<cfset X = 1>
<!--- Example that fails existence test --->
<cfif IsDefined("Foo") AND IsCustomFunction(Foo)>
Foo is a UDF.<br>
</cfif>
<!--- Example that passes existence test but fails IsCustomFunction --->
<cfif IsDefined("X") AND IsCustomFunction(X)>
X is a UDF.<br>
</cfif>
<!--- Example that passes both tests--->
<cfif IsDefined("realUDF") AND IsCustomFunction(realUDF)>
realUDF is a function.<br>
</cfif>
<!--- Example using a CFC, defined in TestCFC.cfc--->
<cfobject component="TestCFC" name="myTestCFCobject">
<CFIF IsDefined("myTestCFCobject.testFunc") AND
Description
Name of a custom function. Must not be in quotes. If not a defined variable or
function name, ColdFusion generates an error.
function returns true for any function that can be called as a custom
declarations and
function
IsCustomFunction
cffunction
529