IsFunc() - Syntax & Usage | AutoHotkey

AutoHotkey

IsFunc() [v1.0.48+]

Returns a non-zero number if the specified function exists in the script.

MinParamsPlus1 := IsFunc(FunctionName)

Parameters

FunctionName

The name of the function whose minimum number of parameters is retrieved. FunctionName must exist explicitly in the script. In [v1.1.00+], FunctionName can be a function reference instead of a name.

Return Value

This function returns one plus the minimum number of parameters (e.g. 1 for a function that requires zero parameters, 2 for a function that requires 1 parameter, etc.). If FunctionName does not exist explicitly in the script (by means such as #Include or a non-dynamic call to a library function), it returns 0.

Related

Dynamically Calling a Function, Function References, Func Object, Func(), A_ThisFunc

Examples

count := IsFunc("RegExReplace") ; Any function name can used here.
if count
    MsgBox, % "This function exists and has " count-1 " mandatory parameters."
else
    MsgBox, % "This function does not exist."