Missing chunk scripting issue

Alex Tweedly alex at tweedly.net
Sat Dec 18 19:34:42 EST 2004


At 17:09 18/12/2004 -0700, Barry Levine wrote:

>Greetings, Listas.
>
>The following two lines of code are causing me a headache:
>
>put the number of chars in line 1 of field "result" into theLast
>put char (theLast - 3) to char (theLast) of line 1 of field "result"
>-- message box should display the last four chars of line 1 of the field
>
>If I use only the first part of the range - char (theLast - 3) of line 1 of
>field "result" - or the last part of the range - char (theLast) of line 1 of
>field "result - I do not get an error.
>
>Obviously I've got some kind of syntax problem with how I'm defining the
>range. Anyone care to suggest a solution?

Your problem is an extra "char" in there
>put char (theLast - 3) to char (theLast) of line 1 of field "result"
should be simply
>put char (theLast - 3) to (theLast) of line 1 of field "result"
with extra parenthesis if needed.

But the *solution* is what Richard suggested, i.e. use negative indices; 
except that "theLast-3" should be "-4", so
>put char  (-4 to -1) of line 1 of field "result"

-- Alex.


More information about the use-livecode mailing list