Library stack - New user surprise

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Library stack - New user surprise

Post by Simon Knight » Sat Sep 25, 2010 10:41 am

I offer the following observation so that someone else may avoid several hours of head scratching :

While trying to write my first large application I have started experimenting with library stacks. Some of my functions load data from disk. For a quick and dirty check of what my code has loaded I added a field "debug" to my library stack/card and added a line of code to write the text into the field. However, when run the function throws an error reporting that the field can not be found.

Code: Select all

put c138Fields into field "debug"
The reason? The code looks for the field "debug" on the card/stack that invoked the routine not the stack where the code is stored.

I suspect that I have caused the "problem" by only using short names for the field.
best wishes
Skids

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Library stack - New user surprise

Post by Klaus » Sat Sep 25, 2010 10:46 am

Hi Simon,

yes, when starting a command like the one above, Rev will check if the currently active card
of the currently active stack (the defaultstack) does have a field named "debug" and will of course
complain otherwise :D

So you need to:
1. add a long descriptor (...fld "debug" of cd 1 of stack "xyz")
OR
2. set the defaultstack first to the sack with that field:
...
set the defaultstack to "the one wiht the debug field in it"
put c138Fields into field "debug"
...


Best

Klaus

Post Reply