Editing Ar Next

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{Function
{{Function
  |origin = NVSE
  |origin = NVSE
  |summary = Returns the next key of an array, after the one specified. For regular arrays (list arrays) this is just equivalent to <b>(SpecifiedKey + 1)</b>. This function is most useful for map and stringmap arrays, where keys are dynamic.  
  |summary = Returns the next key of an array, after that specified. For regular arrays (list arrays) this is just equivalent to <b>(SpecifiedKey + 1)</b>. This function is most useful for map and stringmap arrays, where keys are dynamic. Note that map and stringmap arrays are always sorted in ascending numeric or alphanumeric order, regardless of the order of element insertion.
 
Note that map and stringmap arrays are always sorted in ascending numeric or alphanumeric order, regardless of the order elements were inserted.


Returns a bad index ([[Ar_BadNumericIndex]] or [[Ar_BadStringIndex]]) if there is no next key in the array.  
Returns a bad index ([[Ar_BadNumericIndex]] or [[Ar_BadStringIndex]]) if there is no next key in the array.  
  |name = Ar_Next
  |name = Ar_Next
  |returnType = key:int/float/string
  |returnType = key:int-or-float-or-string
  |arguments =  
  |arguments =  
   {{FunctionArgument
   {{FunctionArgument
   |Name = Source
   |Name = Source
   |Type = array}}{{FunctionArgument
   |Type = array}}{{FunctionArgument
   |Name = Key
   |Name = Previous
   |Type = int/float/string}}}}
   |Type = key}}}}
==Example==
==Example==
<pre>
<pre>
array_var MyMap
array_var MyMap
float MapKey ; * or string_var as appropriate for array
int iKey ; * or float/string_var as appropriate for array
 
let MapKey := Ar_First MyMap ; * The First Key


let MapKey := Ar_Next MyMap, MapKey ; * The Next Key
let iKey := Ar_First MyMap ; * get first element


if MapKey == Ar_BadNumericIndex
while iKey != Ar_BadNumericIndex
     ; Then there is no next key in the map
     ; do something for every valid key in array
endif
    let iKey := Ar_Next MyMap, iKey
loop
</pre>
</pre>


Please note that all contributions to the Fallout3 GECK Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see GECK:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)