Show globals
Rob Cozens
rcozens at pon.net
Thu Dec 11 13:56:00 EST 2008
Bob, et al:
>I would only use
>script local variables for temporary variables that only need to live
>while the script runs
The Rev Dictionary says:
"The difference between a script local variable and a global variable
is that a script local variable can only be used in the handlers of
one script, while a global variable can be used in any handler or
script with a global declaration for that variable.
.
[snip]
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."
So script local variables have value persistence so long as the stack
or app remains open.
And script local variables cannot be accidentally or purposely read
or changed by scripts in other stacks or other objects.
Having said the latter, I would note that any script local variable
can be accessed by handlers in other scripts or stacks, if the script
declaring the local variable includes a getValue function and a
setValue command for that variable. Eg:
local mySharedVariable
function getValue
return mySharedVariable
end getValue
on setValue newValue
put newValue into mySharedVariable
end setValue
Rob Cozens, CCW
Serendipity Software Company
Vive R Revolution!
More information about the use-livecode
mailing list