Declaration of Local Variables

Rob Cozens rcozens at pon.net
Sun Apr 13 13:19:01 EDT 2003


Hi All,

My mystery of the morning was why

     local clientDbList

     put sdbDbId&return before clientDbList[sdbClientId] -- LIFO
     put (the keys of clientDbList)

worked, but

     on  showLists
       put (the keys of clientDbList)
     end  showLists

     local clientDbList

     put sdbDbId&return before clientDbList[sdbClientId] -- LIFO
     showLists

didn't.

Then I moved the local declaration before the showLists handler in 
the script, and all was well.

I had assumed a declared local variable anywhere in a script would be 
recognized by all handlers in the script.  Obviously, this is not the 
case.

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.com/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the use-livecode mailing list