At 18:14 -0600 29/04/02, Tom Richardson wrote:

>I have a need to reset all globals (hundreds of them) but hang onto 
>a small hand full

Here's a utility for that:

on clearButTheseGlobals aList
   tTempPList = [:]
   repeat with tProp in aList
     tTempPList[tProp] = (the globals)[tProp]
   end repeat
   clearGlobals
   repeat with tProp in aList
     (the globals)[tProp] = tTempPList[tProp]
   end repeat
end

And a test for it:

on test

   repeat with i = 65 to 70
     tProp = symbol(numToChar(i))
     (the globals)[tProp] = random(100)
   end repeat

   put #showGlobals1
   showGlobals
   put

   clearButTheseGlobals([#A, #C])

   put #showGlobals2
   showGlobals
   put
end

And the test output:

-- Welcome to Director --
test
-- #showGlobals1

-- Global Variables --
version = "8.5.1"
A = 30
B = 78
C = 33
D = 17
E = 3
F = 96
--
-- #showGlobals2

-- Global Variables --
version = "8.5.1"
A = 30
C = 33
--

Da?
Jakob

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to