Reverse a list

Mark Wieder mwieder at
Mon Feb 9 15:13:46 EST 2015


Using 'repeat for each' for the loop makes this faster yet.

function arevers p
   local t
   local tNumElems
   split p by cr
   put empty into t
   put the number of lines in p into tNumElems
   repeat for each line l in p
      put p[tNumElems] & cr after t
      subtract 1 from tNumElems
   end repeat
   return t
end arevers

 Mark Wieder
 ahsoftware at

More information about the Use-livecode mailing list