Arrays
InstallShield 2022 ยป InstallScript Language Reference
You can declare and use any InstallScript data type as an array. To declare a variable as an array, append an open parenthesis and a close parenthesis, with an array size optionally between the parentheses, to the variable name in the declaration. For example, the following declares a variable called nArray to be an array containing 10 NUMBER elements:
NUMBER nArray(10);
If you do not declare an array size, for example,
NUMBER nArray( );
the array size defaults to zero. You can resize arrays in the script by using the Resize operator. You can get the size of an array by using the SizeOf operator.
Use the following syntax to assign values to array elements:
Syntax
<array variable name>(<array index>) = <value>;
For example:
nArray(0) = 1; /* Array indexing begins with zero. */
nArray(5) = 17;
When declaring a script-defined function that takes an array as an argument, do not use an array as the parameter data type; for example:
prototype NUMBER AverageValue( NUMBER( ) ); /* This will not compile. */
Instead, use the VARIANT data type; for example:
prototype NUMBER AverageValue( VARIANT );
function OnBegin( )
NUMBER nAverage, nArray(10);
begin
/* Assign values to array elements here. */
/* Pass the array to the function. */
nAverage = AverageValue( nArray );
end;