Digging Huge Files

Jim Ault jimaultwins at yahoo.com
Wed Aug 5 15:54:10 EDT 2009


Tip:
There are globals, script locals, and handler locals.

Globals belong to Revolution, not the stack or script that created  
them in memory.
These values persist even if the stack is removed from memory.

Script locals are kept in memory as long as the stack is open.
In a way. like globals, but these are only available to handlers and  
functions in the *same* script.
Declaring a script local variable "shoebox" in different script  
containers creates separate shoeboxes.  Each shoebox will die when the  
script is removed from memory.
---- the script of card 1 "Husband's closet"---
    local shoebox
    put "brown loafers" into shoebox

---- the script of card 2  "Wife's closet"  ---
    local shoebox
    put "sequin pumps" into shoebox

... and you now have two shoeboxes in two places

Handler locals die at the end of the handler process.
on doThisQuickly
    local shoebox
    --and now we are done
end doThisQuickly
... and now this shoebox is gone

global shoebox
... not a good idea to name a global and a local the same
Usual convention is to use  gShoebox for a global name
My convention is to use
zShoebox so that all the globals are shown at the bottom of the  
Variable Watcher
xShoebox so that all the script locals are shown just above the  
globals in the Variable Watcher

Hope this helps someone out there.

Jim Ault
Las Vegas


On Aug 5, 2009, at 12:21 PM, Sivakatirswami wrote:

> 1) I thought local variables are always initialized to empty after  
> each run of  script.
> Is there something I'm missing there?
>
> global tStart
> local tPartials,tRevHits,tCompleted # these were acting as globals?

Jim Ault
jimaultwins at yahoo.com






More information about the use-livecode mailing list