newbies: beware script locals

Ivers, Doug E Doug_Ivers at lord.com
Fri Feb 21 09:14:01 EST 2003


Maybe everyone already knows this, but script locals can cause major frustration when debugging...

I love script locals, those local declarations at the top of your script outside of all handlers:

local myLocalVariable

on openStack
  put 7 into myLocalVariable
  ...
end openStack

on mouseUp
...
end mouseUp

I use them a lot in my top level script.  They are great because I don't have to declare them in each handler and they are "safer" than globals, if you know what I mean.

The caution is that whenever you edit the script, the value of the local goes away.


-- D




More information about the use-livecode mailing list