Array := Object("b", "1st", "a", "2nd") For Key, Value in Array MsgBox %Key%, %Value%For some applications, however, it is important that the keys be presented in the order that they were created. I the script above, for instance, b, 1st was probably wanted before a, 2nd. Searching the forums, I found this post buried in the support section from two years ago.
I took up Lexikos' challenge and added the .Insert(), .InsertBefore() and .Remove() methods. I also changed the __set method to allow the array to be sub-classed if necessary.
Examples assume OrderedArray() is in one of your Standard Libraries.
Example of InsertBefore()
Edited by rbrtryn, 19 August 2013 - 01:32 AM.