Missing chunk scripting issue

Richard Gaskin ambassador at fourthworld.com
Sat Dec 18 19:20:34 EST 2004


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?

You can use "-1" instead of getting the last char to shorten it a tad.

When in doubt you can often use parentheses to make things explicit for 
the compiler:

   put (char -3 to -1 of (line 1 of fld "result")) into tLast

The outer-most parens are probably overkill, but in general parens are 
useful not only for the compiler but sometimes for aiding readability 
too. The outer parens make it clear what's being "put", and the inner 
parens help break the first parsing operation from the second.

Let me know if that doesn't do it and we'll look into it more.

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list