Reloading a changed stack file

Richard Gaskin ambassador at fourthworld.com
Sun Sep 28 21:47:42 EDT 2008


Chipp Walters wrote:

> On Sun, Sep 28, 2008 at 7:31 AM, Len Morgan <len-morgan at crcom.net> wrote:
> 
>> My problem is how to I get rid of this in-memory copy and replace it with
>> the new version (assuming that I had to download a new version)?
>>
>> Is it as simple as:
>>
>> if tVersionUpdated then
>>   stop using tCurrentStack
>> end if
> 
> 
> Revert can work. I like to use the 'delete stack' command as well for this
> sort of thing. It forces the removal of a stack from memory.
> 
> if tVersionUpdated then
>    delete stack tCurrentStack
>    go stack tCurrentStackFilename
> end if

One cautionary note for newcomers:  the "delete stack" command is a 
"sometimes" command - sometimes it does what it says, other times it 
does what you want. :)

"Delete stack" doesn't delete the stack if the stack in question is a 
maintstack.  With mainstacks, it merely removes it from memory, and has 
no effect on the existence of the file on disk.

But when using "delete stack" on a substack, it will delete indeed the 
substack from the stack file, which may or may not be what you want.

This bifurcated behavior warrants some caution, at least until we get a 
true "purge" command, which seems a more sensible option when what we 
want to do is purge a stack without deleting it:
<http://quality.runrev.com/qacenter/show_bug.cgi?id=1081>

I tend to use "revert" myself, so I don't have to worry about whether 
the stack is a substack or mainstack.

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list