When you split data into an array, you cannot use any "clear" techniques to 
process that data, like a repeat loop. You can work with the keys of the array, 
but not the enclosing named array itself.


The number of lines of the named array will always be 0, because the data lies 
at least one "layer" down. When you drill into its elements, things start to 
come back to life. 



-----Original Message-----
From: Dave Cragg <dave.cr...@lacscentre.co.uk>
To: How to use LiveCode <use-livecode@lists.runrev.com>
Sent: Mon, Feb 9, 2015 4:54 pm
Subject: Re: Reverse a list


Mark,

It makes it faster, but it doesn’t return any data. :-)

The number of lines in p = 0

Cheers
Dave

> On 9 Feb 2015, at 20:13, Mark Wieder <mwie...@ahsoftware.net> wrote:
> 
> Dave-
> 
> 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
> ahsoftw...@gmail.com
> 
> 
> 
> _______________________________________________
> 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