Mod:Creation Kit/RFind - Array

Member of: All Arrays

Locates a particular value inside an array and returns the index, starting from the end of the array, and moving to the beginning.

Syntax
int Function RFind(/element type/; akElement, int aiStartIndex = -1) native

Parameters

 * akElement: The element to locate
 * aiStartIndex: Where to start the search. If this is -1 it starts at the end of the array.
 * Default: -1

Return Value
The index of the item in the array, or a negative value if it was not found.

Examples
if (MyIntArray.RFind(1) < 0) Debug.Trace("Did not find 1 in the array") endIf int firstPosition = MyStringArray.RFind("Hello") Debug.Trace("The last Hello is at position " + firstPosition) int secondPosition = MyStringArray.RFind("Hello", firstPosition - 1) Debug.Trace("Found second to last Hello at position " + secondPosition)