Comment about "do" (was clickLine/clickcharchunk)

Geoff Canyon gcanyon at gmail.com
Wed May 8 08:18:03 CDT 2013


On Tue, May 7, 2013 at 9:29 PM, Richard Gaskin
<ambassador at fourthworld.com>wrote:

> ...we can simply write with confidence:
>
>  set the text of tObject to resDate
>


Richard, you beat me to it -- and here I thought I might be the only one
who understands the distinction.

This works (as far as I know) with all properties. If a variable contains a
reference to something that has properties -- an id, name, chunk, etc, --
then referencing those properties will work. It's a bit tricky. I was going
to say that "into" does nothing special, but "of" dereferences the variable
to whatever it identifies, but that's not true. For example, this
successfully updates the line *after* the one you click:

on mouseUp
   get the clickline
   add 1 to word 2 of it
   set the text of it to random(99)
end mouseUp

So I have to go back to the original: you can set a property on a variable
containing a reference, and LC will use the reference. "of" alone isn't the
magic word here.


More information about the use-livecode mailing list