Reusable Code (again)
Robert Brenstein
rjb at rz.uni-potsdam.de
Tue Nov 30 06:01:34 EST 2004
>Sorry, I meant to ask for a variable example, not a
>constant. My question is this then ...
>
>How do I have my reusable stack introduce a global
>variable that can be passed around in an application
>that uses the stack? Can I declare a global variable
>in the stack script of the reusable stack and then use
>the 'start using' construct that was described
>earlier?
>
>Does this avoid having to declare the same global
>variable in the rest of my app?
>
>Best
>
>Gordon
Yes, you can use the libraryStack handler to initialize your globals
in your library stack.
on libraryStack
global myHalfCircle
put 180 into myHalfCirle
end libraryStack
The libraryStack message is sent when you call "start using" for your
library stack, so is well suited for this purpose.
Of course, you still need to connect to those globals in each handler
that uses them by including, for example,
global myHalfCircle
Robert Brenstein
More information about the use-livecode
mailing list