Ditto, and I am not sure what noticeable impact one method would have over 
another. There was some blurb a long time ago about how these keys are 
internally sorted. I believe what was proposed is that a set of NUMERIC keys 
beginning with 0 would actually sort correctly. 

Bob S


> On Sep 2, 2020, at 8:24 AM, Ralph DiMola via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> 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

_______________________________________________
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