ezeio2:scriptref:inarray

Search an array for a value

Description

inArray( needle, const haystack[], size=sizeof(haystack) )

Search an array for a value

Parameters

needle Needle value to search for
haystack Haystack array
size Number of items in Haystack

Return value

If the needle value is found, returns the index in the array (0-indexed).
If not found, returns -1.

Example usage

 
    new mynumbers[] = [8, 6, 7, 5, 3, 0, 9]; 
    new x;
 
    x = inArray(7, mynumbers);
    // x = 2 
 
  • ezeio2/scriptref/inarray.txt
  • Last modified: 2026-12-02 17:34
  • by andreh