Reusability: Importing existing stacks

Cubist at Cubist at
Tue Nov 23 04:30:26 EST 2004

sez gwalias-rev at
>Suppose I want to write e.g. a generic kind of stack
>for entering and storing somebody's name, address and
>contact details - exactly the kind of stack you could
>imagine one might wish to use in a whole host of
>business applications for example. Now supposing I
>want to use that stack in my whizzy e-business app for
>recording my client's details - is there some safe and
>easy mechanism by which the main (container) app can
>apprise itself of all the variables, functions etc. in
>my name/address stack so that they are available
>throughout the main app, or do I have to declare all
>my name/address variables again as globals in my main
   For functions and other handlers, something in this ballpark...

start using stack "Generic Data Entry Stack"

   ...might do the job for you. For data (variables), it depends on the 
specific details of how the data is handled in the "generic stack". If you've got 
your data tucked away in custom properties of the "generic stack", this should 

put the PrimaryAddresses of stack "Generic Data Entry Stack" into 

   If you've got your variables stored as a text file on disc, you can read 
that file from your main stack. If your variables are stored within fields in 
the "generic stack", do this:

put field "PriAddresses" of card "Fred" of stack "Generic Data Entry Stack" 
into JustARandomVar

   Again: The exact protocol depends on the details of the "generic stack". 
Since you're apparently going to write the "generic stack" from scratch, 
yourself, you can pretty much do whatever you like! Decide how you want it to work, 
and then it's time to rock & roll.
   Hope this helps...

More information about the Use-livecode mailing list