Failing to understand the oddities of the "line" chunk

Alex Tweedly alex at tweedly.net
Sat Mar 17 15:59:59 EDT 2012


Thanks Jacque. I kept seeing it as "line 2  to the end" and so expected 
it to go there.

I now see it; so I can simply do

constant infinity=9999999999
put "a" & CR into t; put "b" into line 2 to infinity of t

and I get the right (i.e. desired :-)  answer.

Thanks !!
-- Alex

On 17/03/2012 16:33, J. Landman Gay wrote:
> On 3/17/12 8:16 AM, Alex Tweedly wrote:
>> 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 ?
>
> It's because of how the engine ignores trailing delimiters. The 
> variable t contains only one line, so "line 2 to -1" evaluates to 
> "line 2 to 1".
>





More information about the use-livecode mailing list