Tile - Array - Index Of – Ylands

From Bohemia Interactive Community
Jump to navigation Jump to search
m (YlandsClassyBot moved page Ylands Tile - Array index of to Ylands:Tile - Array - Index Of: New Structure)
m (Text replacement - "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|14}}}}" to "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|7}}}}")
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Image:Editor-VS_tile-array_index_of.png]]
<!---
*Returns '''position''' (index) of the specified '''object'''
THIS PAGE WAS GENERATED AUTOMATICALLY; DO NOT EDIT IT, OTHERWISE YOUR CHANGES WILL BE LOST DURING FUTURE UPDATE.
*If the item is present more than once, instruction returns the position of the '''first occurrence'''.
-->
*Returns '''-1''' if the object is '''not found'''.
== Index Of(Array, Object) ==


=Notes=
[[File:YlandsTile-192.png]]
*Index numbers always start from 0, e.g: Array of [[Ylands Tile - Array length|length]] 3 has indexes 0, 1, 2
 
<pre>indexOf(object: T): number;</pre>
=== 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 ===
 
[[Ylands:Tile Availability - Client|Client]], [[Ylands:Tile Availability - Server|Server]], [[Ylands:Tile Availability - Custom Controller|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.




----
----
{{Navbox/Ylands}}
{{Navbox/Ylands}}
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|14}}}}
{{DEFAULTSORT:{{#sub:{{PAGENAME}}|7}}}}


[[Category: Instructions]]
[[Category: Instructions]]
[[Category: Ylands 0.10]]

Latest revision as of 14:23, 24 November 2023

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.