How to set up a library?

Alex Tweedly alex at tweedly.net
Thu Dec 31 21:19:21 EST 2020


On 31/12/2020 17:12, Bob Sneidar via use-livecode wrote:
> Setting the behavior of something is a one time thing. Start Using is something that has to be done every time a stack is opened, unless another stack in the IDE has done so. Doing it more than once has no effect, other than pushing the script to the back of the stacks in use.

ummmmm - not 100% "no effect".

If you have a 'librarystack' handler it will be run each time you 'start 
using' the stack, and therefore if it does something without checking 
for having been already run, you can get unexpected effects. (For 
example, if your librarystack handler was to explicitly set some 
variable to empty then that would overwrite (i.e. lose) any value set 
since the previous occurrence.

Like others have said, I use a folder (I call it Libraries) with the 'My 
Livecode' folder to hold all my libraries (and I make sure they can be 
'start using'ed multiple times. If I have a library which depends on 
other libraries, I give it a librarystack handler which (among other 
things) will 'start using' any libraries it requires.

Alex.





More information about the use-livecode mailing list