Comment about "do" (was clickLine/clickcharchunk)

dunbarx at aol.com dunbarx at aol.com
Wed May 8 08:12:53 CDT 2013


Thierry.


I am not sure what you mean. My two scripts were intended to be examples of how LC evaluates different types of elements within its own structure.


You can:


put foo into the clickLine --and insert foo into a line in a field


You cannot:



get the clickLine

put whatever into it  -- and expect that foo will be inserted into a line in a field




The foo will go into the variable it, not into the evaluated contents of it, which is a string containing a "valid" clickLine reference.


So you have to use a "do" construction.


I was making the point that LC (and HC before it) were so forgiving of syntax that if you could mentally parse a string into a valid LC statement, the engine ought to "read your mind" as Jacque said. That mental parsing is a stretch for the engine, though, and I understand why.


Craig
















-----Original Message-----
From: Thierry Douez <th.douez at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, May 8, 2013 3:19 am
Subject: Re: Comment about "do" (was clickLine/clickcharchunk)


2013/5/8 <dunbarx at aol.com>

>
> But there are times when "do" is unavoidable, and also times when it is
> invaluable.

For example, in a locked field with some lines of text in it:
>
> on mouseup
>    put random(99) & return  into the clickLine --Works fine. Direct,
> immediate use of the function
> end mouseup
>
> on mouseup
>    get the clickLine  --puts some "distance" between the clickLine as a
> function and as a string in a variable.
>
>    --  put random(99) into it  --does not work, though it seems like it
> should
>    do "put" && random(99) &&  "into" &&  it  --works
> end mouseup
>
> Craig
>
>
Hi,

coming a bit late, but the do can be avoided in this case:

   get random(99)

will put the result in the IT var.

Regards,

Thierry

------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 


More information about the use-livecode mailing list