Globals Question

Troy Rollins troy at rpsystems.net
Wed Nov 2 10:33:43 EST 2005


On Nov 2, 2005, at 9:20 AM, David Burgun wrote:

> This is what I don't understand. If I define gGlobal in the stack
> script and also define it in the card script, are there one or two
> gGlobals's created?

Once a variable is declared as global, there should be only a single 
variable with that name. However as you've seen, you can cause problems 
in your project by not identifying the variable as global within each 
script which uses it. As long as you declare the global in each script 
that accesses the variable, it will always reference the same stored 
data. If you do not declare it as such, the script will create a new 
local variable with the same name, which does not reference the 
global's data. (This would generally be a bad thing to do.)
--
Troy
RPSystems, Ltd.
http://www.rpsystems.net




More information about the use-livecode mailing list