best way to open a script-only library stack?

Richard Gaskin ambassador at fourthworld.com
Mon Sep 17 21:45:19 EDT 2018


Curtis Ford wrote:

 > I'm just getting started with the idea of a library stack for scripts,
 > and have a dopey question: what's the best way to edit the library as
 > I work on the project?
 >
 > I've created a script-only stack and included
 >
 > start using stack "myScriptStack.livecodescript"
 >
 > in the preOpenStack handler of my main stack.
 >
 > When I open the main stack, I don't see a way to get to the library
 > stack. So I open the library stack through 'recent files' in Livecode,
 > but then I see the message "A stack [library stack name] in file [path
 > to the main stack file] is already in memory. The LiveCode UI does not
 > distinguish stacks which have identical names, so editing these stack
 > files while both are in memory could result in data loss."
 >
 > If this is a real concern, how do I get back to work on the library
 > stack? Any suggestions on best practices?

There is only one thing to know about script-only stacks:  they are just 
like the binary stacks in every respect, except that the only thing that 
is written to disk is the stack script.

While in memory it has all the properties of any stack in memory.  You 
can even add objects to it.  Add a hundred cards if you like, and a 
thousand custom props too.  Set its backcolor.  It's all good, as long 
as you know the one rule about script-only stacks: the only thing that 
will get written to disk is the script.

Once this one rule is accepted, so many things become clearer. 
Mysteries that seemed somehow specific to script-only stacks go away. 
Many lights come on, many doors open.


The error you experienced can happen with any stack file.  Replace your 
script-only stack with a binary one and you'll see.  Sometimes opening a 
stack depends on *how* you opened it, with a partial or a full path, or 
how the path was derived.

For example, here are two ways to describe one file path:

   /home/rg/Desktop/stack.livecode
   ~/Desktop/stack.livecode

If I use each of those in separate statements, LC will complain that I'm 
attempting to open two different stacks with the same name, despite both 
paths being for the exact same file.

I had reported that once, but can't find the report now. :(

But what I learned stays with me:  double-check that you're using the 
exact same path to the file both times you access it, when using it as a 
library and when opening it.

If you do and the problem persists, let's explore it further.

-- 
  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