David,

Nope you have to sort them NUMERIC. As you said this is the only way I know of. 
I do this all the time. I don't know of any other way.

put the keys of tMyArray into tKeys
sort lines of tKeys numeric
repeat for each line tKey in tKeys

-- do what you want with tMyArray[tKey]
-- this line will put the array data in the message box (assuming there is no 
other sub keys in each numeric array entry).
put tMyArray[tKey] into tMyVar

end repeat

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
David Bovill via use-livecode
Sent: Wednesday, September 02, 2020 10:55 AM
To: How to use LiveCode
Cc: David Bovill
Subject: Looping though a numerically indexed array

I’m pretty sure there must be a way to efficiently loop through numerically 
indexed arrays

Repeat for each key and repeat for each element does not seem to sort the keys 
in numeric order,. Of course I can get the keys and sort them before repeating 
- but is there a more efficient way?
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to