Determines whether a name represents a custom function.
True, if name can be called as a custom function; False, otherwise.
IsCustomFunction(name
)
Parameter |
Description |
---|---|
name |
Name of a custom function. Must not be in quotation marks. If not a defined variable or function name, ColdFusion generates an error. |
The IsCustomFunction function returns True for any function that can be called as a custom function, including functions defined using CFScript function declarations and cffunction tags, and functions that are ColdFusion component methods. For CFC methods, you must first instantiate the component.
<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 IsCustomFunction(myTestCFCobject.testFunc)> myTestCFCobject.testFunc is a function. </CFIF>