Find - Array

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: All Arrays

Locates a particular value inside an array and returns the index

Syntax[edit | edit source]

int Function Find(;/element type/; akElement, int aiStartIndex = 0) native

Parameters[edit | edit source]

  • akElement: The element to locate
  • aiStartIndex: Where to start the search
    • Default: 0

Return Value[edit | edit source]

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

Examples[edit | edit source]

if (MyIntArray.Find(1) < 0)
  Debug.Trace("Did not find 1 in the array")
endIf


int firstPosition = MyStringArray.Find("Hello")
Debug.Trace("Found Hello at position " + firstPosition)
int secondPosition = MyStringArray.Find("Hello", firstPosition + 1)
Debug.Trace("Found a second Hello at position " + secondPosition)

See Also[edit | edit source]