Script Only stacks

Richard Gaskin ambassador at fourthworld.com
Fri Feb 19 18:04:37 EST 2016


William Prothero wrote:

 > I decided to check out script only stacks. I am in LC8 (DP14). I
 > noticed that there is a sub-menu item in “New Stack”, at the bottom
 > of the list, for a “Script Only” stack. Fine and dandy. It shows up
 > in the Project Browser. But, when I click on the icon to the left of
 > the stack entry (in the project browser), it opens and a card appears
 > below it. I thought script only stacks had only the stack, not cards.
 > So, is the Project Browser converting the stack to a regular stack?

A script-only stack is just that:  a plain text file in which the first 
line is:

stack "stackname"

...and below that is the stack's script.  That's it.  You can see 
several examples throughout the IDE install.

When the engine reads a text file with that header using any normal 
stack-access syntax (e.g. "open stack" or "start using") it instantiates 
an actual stack object from it.  And since a stack in LiveCode can't 
exist without a card, the card comes along for the ride.

While it's in memory it behaves just like a LiveCode-native binary stack 
- you can even set custom properties in it.  Just be aware that 
regardless what you do with it while it's in memory, the only thing that 
will be saved in a script-only stack is, as the name implies, the script.


 > Just wondering about script only stacks. I use a lot of substacks to
 > hold various script resources, and it looks like there might be just
 > a bit less overhead in script only stacks.
 >
 > BUT, can script only stacks be substacks?

No.  A substack is part of the native binary stack structure of a normal 
stack.  As such, only other native binary stacks can be used as 
substacks, and only in a native binary mainstack.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com





More information about the use-livecode mailing list