just a comment

Jim Ault JimAultWins at yahoo.com
Tue Nov 28 01:36:49 EST 2006


On 11/27/06 10:03 PM, "John Vokey" <vokey at uleth.ca> wrote:

> All,
>    One of my students got caught by the following in her stack:
> 
>    At the top of the card script, she declared some variables local
> to the scripts of that card, as we always we do.  For one of these
> variables, she did not initialise it in any way.  However, the use of
> that variable is always done with ``put tab and someData after
> thelocalvariable''.  No problem on first use, but the stack always
> returns to the first cd of the stack to run the next subject, and
> when it gets back to this cd, the local variable still exists (as if
> it were a global), so the ``tab & someData'' gets added to the end of
> the data from the previous run.  No big deal, as we can just clear
> the variable in the opencard handler, but it is surprising, as local
> variables are not supposed to be persistent, at least to my knowledge.

There are two kinds of 'local' variables...

script local
--persistent
--are only in the scope of that script

handler local  
--they evaporate when the handler ends
--they are only in the scope of that handler


Exception: (rarely used, so ignore if it is confusing)
If the script of the container is set to empty by another Rev handler, then
set to a script including the same script local, the script local will lose
the original value.  For those interested, contact me for clarification, but
less than 0.0001 % of the Rev users will care about this.

Jim Ault
Las Vegas






More information about the use-livecode mailing list