ucArgCount

 

See Also: ucDefineFunction, ucDefineOperator, ucArg, ucArgHandle, ucReturn

 

Retrieves the number of arguments that are being passed to a Native callback routine. This is useful for functions that can accept a variable number of arguments.

 

ucArgCount(ExpressionHandle)

 

Parameter

ExpressionHandle

All Native callback routines receive one argument, which is ExpressionHandle. This handle is required as the argument of ucArgCount().

 

 

Example:

 

The following routine defines a function named MyAverage, which takes an indefinite number of arguments, and returns the average of these numbers. Once defined, MyAverage(3, 4, 5, 6) returns 4.5.

 

Visual Basic

' The following line can be placed in Form_Load()

ucDefineFunction "Native: MyAverage(x ...)", AddressOf MyAverage

 

' The following callback routine goes in a separate module, such as DemoVB.Bas

Sub MyAverage(ByVal Expr As Long)

Dim x As Long, Total As Double

 

For x = 1 To ucArgCount(Expr)

Total = Total + ucArg(Expr, x)

Next

 

ucReturn Expr, Total / ucArgCount(Expr)

End Sub

 

Examples for other compilers

 

Changes in versions 3.0:

         ucParamCount was renamed ucArgCount. However, ucParamCount was preserved for backward compatibility.