Script local variables and initialization.

Frank Leahy frank at
Thu Dec 23 18:27:01 EST 2004

On Dec 23, 2004, at 10:04 PM, use-revolution-request at 

> From: Dar Scott <dsc at>
> Subject: Re: Script local variables and initialization.
> To: How to use Revolution <use-revolution at>
> Message-ID: <8A29ED85-5525-11D9-9730-000A9567A3E6 at>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
> On Dec 23, 2004, at 1:42 PM, Alex Tweedly wrote:
>> The docs are a bit vague
>>> The value of a script local variable is retained between handlers,
>>> but is lost when you quit the application, when you close the stack
>>> (unless its destroyStack property is false), or when the script is
>>> re-compiled.
>> which doesn't really mention start-up conditions.
> The key word might be "re-compiled".
> I would have thought that it would be re-compiled only once and that at
> first use.
> Here is a way to find out if it is being compiled twice and when.  Use
> a later version and put in a new command in the script.  Then open the
> stack on an earlier version that doesn't have the command.  You will
> get an error when it compiles.  If it really compiles twice, then you
> will get it twice.

It gets recompiled whenever you edit a script and click "Apply".  So, 
if you've initialized something in openCard or preOpenCard, or some 
other pre or open handler, then edit the script, the variables will 
become uninitialized.

-- Frank

Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at

More information about the use-livecode mailing list