OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ZNorQ on 16 May 2004, 20:27:32

Title: ARRAYS; GETTING ELEMENT NUMBER
Post by: ZNorQ on 16 May 2004, 20:27:32
Hey,

The "In" function is nice for checking for a specific element in an array - but how can I get the position number of an element in an array?

Example;

["Cake", "Coffee", "Bread", "Milk"]

Lets say I want the position number for "Bread". I know I can use
"Bread" in ["Cake", "Coffee", "Bread", "Milk"] to find out that it exists...

What would be nice is if "in" returned the position if it existed, instead
of a boolean result.

Anyone?

ZNorQ
Title: Re:ARRAYS; GETTING ELEMENT NUMBER
Post by: ZNorQ on 16 May 2004, 20:39:08
Forget it ppl! Found a function (indexOf)..! He who looks, finds... maybe..

ZNorQ