just a comment
Chipp Walters
chipp at chipp.com
Tue Nov 28 01:36:07 EST 2006
Hi John,
Actually the behavior is correct. If you declare a local variable
OUTSIDE the other handlers of an object, it will stay persistent and
is accessible to all handlers/functions for that object.
This has some nifty benefits. It allows you to create persistent
variables, which aren't global (and therfore less likely to conflict),
and best of all, unlike custom properties, are automatically reset at
opening of a stack.
One thing to note, is the local variables are reinitialized to empty
during the editing of the script of the object-- at least this is the
behavior prior to 2.7. In 2.7, I believe, that behavior can be
changed, so they stay persistent even when editing the script.
You can also create a simple function to access the local variable
from outside the object. Say you have a group "test" with the script:
local lVar
function getlVar
return lVar
end getlVar
then access it:
put value("getlVar", group "test")
HTH,
Chipp
More information about the use-livecode
mailing list