Globals Question

Robert Brenstein rjb at robelko.com
Wed Nov 2 09:15:53 EST 2005


>Hi,
>
>I'm a bit confused over the Scope of Global Symbols. If I have a stack with:
>
>global gGlobal
>
>defined outside of all handlers
>
>and the same in a card or control script BUT in the same Stack, is 
>the same "gGlobal" used in both places?
>
>Thanks a lot
>Dave

There are two aspects to scope that affect you in this case.

1. A global defined outside of all handlers (I presume you mean above 
all handlers) is available to all handlers within a given object, be 
it a button, card, or stack. I think you are clear about this.

2. If the same global variable is defined in multiple objects, be it 
a button, card, or stack, it is the same global even if the objects 
are in different stacks. Globals are environment-wide global. This is 
true regardless whether a global is defined outside of all handlers 
or inside a specific handler.

Robert Brenstein



More information about the use-livecode mailing list