I think the idea is to be able to preload a variable the first time a script is 
accessed in a session, and by session I mean when the application is launched. 
Quitting and re-launching the app would count as a second session. While the 
app is running, you could change the variable and it’s value would be 
persistent UNTIL you recompiled the script.

In this case the form local sVar = “123” would re-initialize the variable any 
time the script is compiled. If you used the form local sVar and then changed 
the value of sVar in an initialization script, the the value would be preserved 
through compiles PROVIDING Preserve Variables was turned on in the script 
editor preferences.

I can see this being useful as a way to flag if a handler is being run for the 
first time in a session, but I’ve discovered that it cannot be used if you 
expect to recompile at any point during a session. So what I do is I have a 
global variable called initialized, and when I open the stack I check the value 
of this variable. If it’s not true, I call an initialization routine. It’s more 
work, but then I don’t run into the unexpected consequences of variable 
pre-loading.

Bob


On Feb 23, 2014, at 14:32 , Graham Samuel 
<livf...@mac.com<mailto:livf...@mac.com>> wrote:

I see that I have misunderstood the context of this 'feature' (if that's what 
it is). It refers to a situation where one runs a script in the IDE, finds an 
error, corrects it and runs it again. It's entirely an IDE thing, isn't it? 
Compilation can happen outside the IDE, for example where a splash stack 
invokes other stacks containing scripts, but the developer doesn't see this 
directly so can't mess with the script and go again. I was thinking in a wider 
context, where the stack gets removed completely from the machine and then is 
brought back. That isn't what it's about.

Not quite so puzzled

Graham

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to