Tile - Array - Index Of – Ylands

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:


==== object ====
==== object ====
Target item in the array


=== Returns ===
=== Returns ===


'''number''' Returns '''position''' (index) of the specified '''object'''. If the item is present more than once, instruction returns the position of the '''first occurrence'''. Returns '''-1''' if the object is '''not found'''.
'''number''' Returns '''position''' (index) of the specified '''object'''. If the item is present more than once, instruction returns the position of the '''first occurrence'''. Returns '''-1''' if the object is '''not found'''.
=== Availability ===
[[Ylands:Tile Availability - Client|Client]], [[Ylands:Tile Availability - Server|Server]], [[Ylands:Tile Availability - Custom Controller|Custom Controller]]


=== Description ===
=== Description ===


Returns '''position''' (index) of the specified '''object'''. If the item is present more than once, instruction returns the position of the '''first occurrence'''. Returns '''-1''' if the object is '''not found'''.
Returns '''position''' (index) of the selected '''object''' in the array.


=== Notes ===
=== Notes ===


* Returns '''-1''' if the object is '''not found'''.
* If the item is present more than once, instruction returns the position of the '''first occurrence'''.
* Index numbers always start from 0, e.g: Array of '''length''' 3 has indexes 0, 1 and 2.
* Index numbers always start from 0, e.g: Array of '''length''' 3 has indexes 0, 1 and 2.



Revision as of 12:17, 12 November 2021

Index Of(Array, Object)

YlandsTile-192.png

indexOf(object: T): number;

Parameters

object

Target item in the array

Returns

number Returns position (index) of the specified object. If the item is present more than once, instruction returns the position of the first occurrence. Returns -1 if the object is not found.

Availability

Client, Server, Custom Controller

Description

Returns position (index) of the selected object in the array.

Notes

  • Returns -1 if the object is not found.
  • If the item is present more than once, instruction returns the position of the first occurrence.
  • Index numbers always start from 0, e.g: Array of length 3 has indexes 0, 1 and 2.