stacks within a stack file

Richard Gaskin ambassador at
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. 

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:

  Richard Gaskin
  Fourth World
  LiveCode training and consulting:
  Webzine for LiveCode developers:
  LiveCode Journal blog:

More information about the Use-livecode mailing list