Modularising Code

Mike Kerner MikeKerner at roadrunner.com
Thu May 8 14:20:31 EDT 2014


Terry,
Definitely use substacks to modularize your code, BUT, I would suggest you
do just a wee bit of reading on the message path, because it's important
for everyone, and all of the questions you asked are discussed there:
1) In the LC toolbar at the top, the second-to right button is "Resources".
 Click it
2) The second link down is the "User Guide".  Click it
3) Inside there search for "message path".  There is a whole discussion of
what it is and how to use it.
4) SEND and PASS and START USING STACK are your friends.




On Thu, May 8, 2014 at 11:57 AM, Terence Heaford
<t.heaford at btinternet.com>wrote:

>
> My understanding is if you create a library of a stack it’s stack script
> is placed between the main stack that has called start using and LiveCode’s
> engine.
>
> Is that correct?
>
> If yes then I presume if you start using a substack then the substack
> script is placed between the main stack that has called start using and
> LiveCode’s engine
>
> Is that correct?
>
> If you only have handlers in the stack script of the substack then any
> messages will only call them after passing through the mainstacks script.
>
> Is that correct?
>
> If you actually use the substack as more than a repository for scripts
> then any control will pass the message through the substacks script to
> mainstack and onto the substack again.
>
> Is that correct or once you start using the substack is it removed from
> the normal message passing and any control only passes to the substack
> script and onto the engine?
>
> I hope the above is understandable.
>
> All the best
>
> Terry
>
>
> On 8 May 2014, at 14:37, Dar Scott <dsc at swcp.com> wrote:
>
> > Remember that the main stack is in the message path of the substack.
>  So, you will have the main stack twice in the message path for cards and
> controls.  This is probably fine.  But, something like a keystroke counter
> in the main stack might count them twice.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list