Quick way to sort arrays?

David Bovill david at openpartnership.net
Tue Jun 19 14:25:08 EDT 2007


Is there a quick way to sort array? Or do I have to get the elements
of each and sort them?

I want to sort an array in which each element is a numeric value, and
I want the keys sorted accordinlgly.

The best i can come up with is this:

function array_GetSortByNumber someArray
    combine someArray by CR and comma
    sort someArray descending numeric by item 2 of each

    set the columndelimiter to comma
    split someArray by column
    put someArray [1] into sortedKeys
    return sortedKeys
end array_GetSortByNumber

Better ideas anyone?



More information about the use-livecode mailing list