Global /local variables

Sarah sarahr at genesearch.com.au
Sun Nov 10 17:45:00 EST 2002


Imagine you have a button, and in it's script you have several 
handlers: mouseUp, processData, doMoreStuff etc. If you put a local 
variable in the button's script but OUTSIDE any of the handlers - say 
on the first line - then all of these handlers can access the data 
stored in that variable. However no other scripts e.g. card script, 
stack script, another button's script - can access that variable. If 
they declare a local variable even using the same variable name, it 
will refer to a new variable.

If instead of "local", you declared that variable as "global", then any 
handler in any script could access it, either by declaring it inside 
the handler or in the script but outside the handler.

Cheers,
Sarah



On Monday, November 11, 2002, at 08:06  am, Andre Rombauts wrote:

> I do not understand the real meaning of global and local variables in
> Revolution... The info about declaring variables outside a handler 
> seems to
> be equal in both cases... :-(
>
>> From the Œlocal¹ entry in Revolution Help system:
>> You can also use the local command in a script, outside any handlers 
>> in the
> script. These local variables can be used by any handler in that 
> script, without
> needing to be declared in the handler itself, and their values are 
> maintained
> from handler to handler
>
>> From the Œglobal¹ entry in Revolution Help system:
>
>> You can also place a global command in a script, but outside any 
>> handlers in
> the script. These globals can be used by any handler in that script, 
> without
> needing to be declared in the handler itself.
>
> André
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>





More information about the use-livecode mailing list