Looping though a numerically indexed array

Ralph DiMola rdimola at evergreeninfo.net
Wed Sep 2 11:24:07 EDT 2020


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
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at 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 at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list