global variables vs. custom properties

Bill Vlahos bvlahos at mac.com
Fri Jan 16 10:12:13 EST 2009


Another difference is that globals work across all open stacks - they  
really are global. If you have a program that has multiple stacks  
(i.e. documents) and set the variable it will be the same across all  
the stacks. I got tripped up by this when I expected a global to be  
used anywhere within that stack but each stack would have its own  
value for the variable.

In my case storing it in the custom properties of the stack not only  
kept the value "global" for that stack it also allowed me to save the  
information.

Bill Vlahos

On Jan 16, 2009, at 7:00 AM, Rob Cozens wrote:

> Hi Tiemo,:
>
>> I know, that most people prefer custom properties, but is it just  
>> a question
>> of "school", or is there perhaps a difference in memory usage or  
>> other "hard
>> facts"?
>
> Custom properties are stored within the stack file when it is  
> saved, whereas globals die when the Rev engine or your standalone  
> quits.
>
> So if your variables are non-persistant, then globals better  
> fulfill that function.  If you have variables that are populated  
> after startup and don't need to persist after shut down, putting  
> them in custom properties simply increases the physical size of the  
> stack file for no useful purpose.
>
>
>
> Rob Cozens CCW
> Serendipity Software Company
>
> "And I, which was two fooles, do so grow three;
>  Who are a little wise, the best fooles bee."
>
>  from "The Triple Foole" by John Donne (1572-1631)
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list