Reset Locals?
Jim Ault
JimAultWins at yahoo.com
Wed Jul 5 22:32:38 EDT 2006
On 7/5/06 6:37 PM, "Scott Rossi" <scott at tactilemedia.com> wrote:
> OK, script local variables are persistent now in 2.7.x. In the readme, if I
> read it correctly, it appears one must do the following to reset the local
> values:
>
> set the script of <targetobject> to tNewScript
>
> Is this correct? Do we really need to set the script to itself (or another
> script) to reset the variables?
>
> The above works here, but this process seems to be, well, unusual. I would
> think I would be able to somehow access the local variables via script and
> reset them. Please let me know if I'm missing something.
This should work in all versions
(I use 'z' for my globals so they get listed at the bottom of variable
watcher)
local sTempp, sNotTempp
global zPerm, zTempp
on test
put "data" into zPerm
put "data" into zTempp
put "data" into sTempp
put "data" into sNotTempp
put sTempp&cr& sNotTempp&cr&zTempp&cr& zPerm
end test
on clearThings
clear local sTempp
clear global zTempp
delete variable zPerm --actually deletes it
--however, then next script that declares it recreates it
--if the other scripts do not declare the global, it does
--not appear in variable watcher
put sTempp &cr& sNotTempp &cr& zTempp &cr& zPerm
end clearThings
Jim Ault
Las Vegas
More information about the use-livecode
mailing list