stacks within a stack file

Richard Gaskin ambassador at fourthworld.com
Mon Apr 11 16:49:16 EDT 2011


stephen barncard wrote:

> I know how to determine the *name* of the *stack file* that's holding a
> loaded stack, but if one knows the *stack file name*, how does one get the
> name of the stacks within?

get the substacks of stack "MyMainStack"

> Does the whole stack have to be loaded first or is there  a way to get the
> names of the stacks inside a stackfile without loading it?

Depends on what you mean by "load".

To read any property of any part of a stack file will cause the entire 
stack file to be loaded into memory.  It will not, however, be "opened" 
per se; that is, it won't trigger the preOpenStack, openStack, etc. 
messages.

In fact, the only way you'd be able to know if it's been loaded into 
memory is to check the mainStacks function.

Once it's in memory you can use the "delete" command to purge it.

IMPORTANT:  the "delete" command doesn't actually delete the stack when 
used on a mainstack, but instead merely purges it from memory.  If used 
on a substack, however, it will actually delete the substack.

To rectify this ambiguity I suggested the addition of a "purge" command 
many years ago:
<http://quality.runrev.com/show_bug.cgi?id=3932>

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv




More information about the use-livecode mailing list