REALLY close stack

Troy Rollins troy at rpsystems.net
Tue Jun 15 17:51:49 EDT 2004


Greets,

I have a stack which references a number of external stack files as 
resources. Only one of these resources can be "active" at a time. The 
user can create these resource stacks, and name them whatever they 
want... but they all have the same "internal" stack name.  When my 
program starts, it looks through the resource directory, loads them one 
by one, extracts enough information to reload the file as the "main 
resource" when requested by selecting it from a list of available 
resources.

The problem? You probably guessed it. Rev won't purge the first file, 
and always complains that there is already a stack open with that name.

In my repeat loop which reads the files I "repeatedly" try to kill the 
darn thing, but they are very persistent. It looks something like this 
-
_________________________________________________________
  repeat for each line tFile in tFileList
     if there is a stack "Current Resource" then
       set the destroyStack of stack "Current Resource" to TRUE
       close stack "Current Resource"
     end if

       go invisible stack URL (the defaultFolder & "/" & tFile)
       if there is a field "NameField" of stack "Current Resource" then

         Put tFile & TAB & field "NameField" of stack "Current Resource" 
after field "Resource Select List" of card "Main Interface" of stack 
"The Program"
       end if

     set the destroyStack of stack "Current Player" to TRUE
     close stack "Current Player"

   end repeat
________________________________________________________

In other words, I try to kill the bugger twice, but no go. Is there a 
"best way" to use and kill a stack, so that another which has the same 
stack name can be used without error messages?

Back workin' in Rev, but a bit rusty I guess. Thanks for any help.
--
Troy
RPSystems, Ltd.
http://www.rpsystems.net



More information about the use-livecode mailing list