|
I have two Arrays with the same lenght(e.g. 3), one Array is a String Array and the other is an int Array. The int Array is sorted and gets a new index starting with the lowest value, how can I get the old index back(without destroying the new index) and compare it with the index of the string Array?
Edit: Changed the Question title, it was misleading. In general I want to print stringID_1 + intID_1 , but not all IDs are needed, only the Highest intID and the lowest this is why Iam sorting the intArray and pass it to a new Array. But after sorting the Indexes of the string_IDs and intID`s are not longer matching
(comments are locked)
|
|
Use a SortedDictionary. This is basically what Niklas did, but with a different class. Why did I get voted down?
Mar 24 '11 at 09:02 PM
Peter G
Dont know. It took some time for me to understand & use Hashtables!
Mar 26 '11 at 01:10 PM
GameGuy
(comments are locked)
|
|
You could use a dictionary instead if you can live with only one of each ID. If not, you could use a list of KeyValuePair instead. This is C# and I'm not sure how this would look in js.
(comments are locked)
|

Are you trying to assign an int to a string and vice-versa? In that case, then you should use a hashtable or dictionary.
Looks like a Hashtable is the the right way, I searched here, the script reference and in the wiki but I cant find the information how to sort a Hashtable. Sort is not a member of Hashtable, and passing the Hashtable to an Array and sort that Array is not working.