Failing to understand the oddities of the "line" chunk

Alex Tweedly alex at tweedly.net
Sat Mar 17 09:16:42 EDT 2012


This code
>      put "a" & CR into t; put "b" into line 2 of t; put t
produces (as I would expect)
> a
> b
BUT
> put "a" & CR into t;  put  "b" into line 2 to -1 of t; put t 
produces
> ba
Why should adding the "to -1" change this to put the new data before 
what was there before ?

I can see that there is no line 2, so saying "line 2 to -1 " does need 
to be interpreted. But if you specify a line number higher than exists, 
normally the string will be padded with enough CRs to make it work, e.g.
> put "a" &CR into t;  put  "b" into line 3 of t; put t
produces
> a
>
> b
but
> put "a" &CR into t;  put  "b" into line 3 to -1 of t; put t
again produces
> ba





-- Alex.




More information about the use-livecode mailing list