Difference between revisions of "Arrayhigh"

From Soldat Community Wiki
Jump to: navigation, search
(Blanked the page)
Line 1: Line 1:
 +
===From the Scripting Manual===
 +
''function ArrayHigh(X: array of variant): integer;''
 +
 +
'''Parameter Info:'''
 +
  X (Array of Variant): This paramater can be an array of any data type.
 +
 +
'''Description:'''
 +
  This function will return the highest index of an array. Example if you have an array of 5 integers {0,1,2,3,4},
 +
  this function will return 4.
 +
 +
  (if this function fails for you, please try [[GetArrayLength]])
  
 +
==Examples==
 +
<source lang="pascal">var
 +
MyArray[0..4] of string;
 +
i: integer;
 +
begin
 +
    MyArray[0] := 'noobs';
 +
    MyArray[1] := 'foo';
 +
    MyArray[2] := 'bar';
 +
    MyArray[3] := 'is';
 +
    MyArray[4] := 'for';
 +
   
 +
    for i := 0 to ArrayHigh(MyArray) do begin
 +
      WriteLn(MyArray[i]);
 +
    end;
 +
end;
 +
</source>
 +
 +
'''Output:'''
 +
  noobs
 +
  foo
 +
  bar
 +
  is
 +
  for
 +
 +
==External Links==
 +
* [http://enesce.com/help/index.html?Functions/Arrayhigh.html Scripting Manual page for Arrayhigh]
 +
 +
[[Category:Server Scripting]][[Category:Server Scripting Functions]]

Revision as of 15:52, 11 September 2012

From the Scripting Manual

function ArrayHigh(X: array of variant): integer;

Parameter Info:
 X (Array of Variant): This paramater can be an array of any data type.

Description:
 This function will return the highest index of an array. Example if you have an array of 5 integers {0,1,2,3,4},
 this function will return 4.

 (if this function fails for you, please try GetArrayLength)

Examples

var
MyArray[0..4] of string;
i: integer;
begin
    MyArray[0] := 'noobs';
    MyArray[1] := 'foo';
    MyArray[2] := 'bar';
    MyArray[3] := 'is';
    MyArray[4] := 'for';
    
    for i := 0 to ArrayHigh(MyArray) do begin
       WriteLn(MyArray[i]);
    end;
end;
Output:
 noobs
 foo
 bar
 is
 for

External Links