ColdFusion 9.0 Resources |
IsCustomFunctionParameters
UsageThe 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, first instantiate the component. Note: To prevent undefined variable exceptions, always
precede IsCustomFunction with an IsDefined test, as shown
in the example.
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 IsCustomFunction(myTestCFCobject.testFunc)> myTestCFCobject.testFunc is a function. </CFIF> |