IsCustomFunction

Description

Determines whether a name represents a custom function.

Returns

True, if name can be called as a custom function; False, otherwise.

Category

Function syntax

IsCustomFunction(name)

Parameters

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.

Usage

The IsCustomFunction function returns True for any function that can be called as a custom function, including functions defined using CFScript function declarations, CFScript function expressions, 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.

For functions defined using function expressions, use isClosure().

Example

 

<cfscript> 
    // CustomFunction 
    function2 = function (sum) {}; 
    writeoutput("Is it a customFunction: " & isCustomFunction(function2)); 
</cfscript>

Output

Is it a customFunction: YES

Adobe logo

Sign in to your account