that probably best describes what i wanted to ask! and "collection" would be the arrayed variable?
I made a mistake. A "Set" best describes what you are doing as I assume you do not give 2 indicies the same value (which is a property of a Set but not of a Collection).
Although such things are implimented in script using arrays ultimatly, the algorthims and procedures used might only accept a certain type of data.
For example, how can you logically return the index of a stored value when the same value has more than 1 index? This is capable of occuring when data is stored in a collection but not when stored in a set (as each value must be unique).
Additionally, you need to define a size for the set. Using a search algorthim has a runtime computational cost proportional to the size of the data pool being searched so itterating through all 2^13 indicies is not fesible. If you only have 1 element stored then you should not need to search at all, and with 2 elements it should itterate only once.
If you store your data in the array in a discontinious way (eg, with blank indicies between stored values) then this will potentially slow the search down (wasted itterations). Obviously you can assign a NO_VALUE constant to tell the search to ignore indicies with no value but this is still not as effective as using a set in the first place.
You might also whish to more directly map an index to a value using a hasthable (or Array if values are in a small range). This is far faster than searching but requires you to keep the 2 mappings syncronized (the index:value and value:index mappings are stored separatly and need to maintain integrity for the system to work bug free).
In eithor way you probably want a set of values.