looking for a smart approach to "sort" an array

hh hh at hyperhh.de
Fri May 5 21:02:41 CEST 2017


Oh, sorry Mike, I didn't think deep enough.

Then your approach to add the field as "sort-element" to the array is
from my point of view clearly the easiest way to go.

> > > Mike B. wrote:
> > > repeat for each line tKey in myArrayA["sortedWords"]
> > >   -- do whatever with each one myArrayA[tKey].....
> > > end repeat
> >
> > hh wrote:
> > Why administrate another object while you have already one?
> > One could rebuild to string from array and sort in one step:
> >
> > put fld "myListField" into mySortList
> > repeat for each line L in mySortList
> >     -- do whatever with each one myArrayA[L] ...
> > end repeat
>
> Mike B. wrote:
> True,  wasn't sure the field would still be available. I think the O.P.
> mentioned  rebuilding the list in user order at a later time (as in from a
> later program run) by loading the array data from a file.  By storing the
> list from the field as part of the array data, it carries the user index
> along with the data being indexed.  (could store the list many ways, but
> all of them require a way to actually save the list between runs, if I
> understand what I read)




More information about the use-livecode mailing list