bad token: theID, iconNum, theVis, etc.

Phil Davis phildavis at attbi.com
Mon Mar 18 22:12:01 EST 2002


In an effort not to overlook anything... to share a local variable among several handlers, you must declare it outside of all handlers, and above all the ones meant to share it. Like this:

==== stack script ====

local theTarg

on mouseUp
  put the target into theTarg
  send "thud" to me in 1 sec
  beep
end mouseUp

on thud
  answer "The recent target was" && theTarg & "."
end thud

==== end of script ====

If the local is declared within the confines of a handler, its scope is that handler only.

Just a thought...

Phil



----- Original Message ----- 
From: "erik hansen" <erikhans08 at yahoo.com>
To: <metacard at lists.runrev.com>
Sent: Monday, March 18, 2002 6:51 PM
Subject: Re: bad token: theID, iconNum, theVis, etc.


> ("thetarg" is in the propertynames) = false
> 
> local theTarg
> put the target into theTarg
> 
> local: name shadows another variable or constant
> line:27  column:3 bad token: theTarg
> Handler: error in command
> Handler: error in handler
> 
> this occured AFTER i had worked my way down half
> of the script "local"izing all local variables.
> all of a sudden in the middle of the page it
> jumped back to "theTarg" at the top. capricious.
> Reference has 3 lines on the explicitVariables
> property, but less info than in your
> communication. declaring all local variables does
> clarify things, and a few glitches did turn up.
> 
> 
> 
> =====
> erik at erikhansen.org                 http://www.erikhansen.org
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard




More information about the metacard mailing list