Reversing a list

J. Landman Gay jacque at hyperactivesw.com
Wed Apr 23 15:10:09 EDT 2008


Sarah Reichelt wrote:
> On Fri, Apr 4, 2008 at 10:14 AM, Sarah Reichelt
> <sarah.reichelt at gmail.com> wrote:
>> And the winner is.......
>>
>>  Jacque (with one modification).
>>
>>  local tCount
>>
>>  function reverseList pList
>>     put the number of lines in pList into tCount
>>     sort lines of pList by mySort()
>>     return pList
>>  end reverseList
>>
>>  function mySort
>>     subtract 1 from tCount
>>     return tCount
>>  end mySort
> 
> OK, this realised this working for me and I finally figured out what
> was going on - the sort needs to be numeric!
> So change the "sort" line to this:
> 
>      sort lines of pList numeric by mySort()

Oops. Good catch. :)

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list