Variable Scoping

Robert Sneidar bobs at
Mon Oct 9 16:09:33 EDT 2006

I am quite familiar with variable scoping. I am just not used to  
scoping that leaves variables in a calling procedure invisible to the  
called procedure. But actually, I read the User Guide (imagine that)  
and came up with this:

Environment variables
Most operating systems that Revolution supports provide information  
about the operating
environment in environment variables.
You can access environment variables by prepending the $ character to  
the variable's
name. For example, the following statement gets the contents of the  
environment variable, which holds the current user's login name:
   get $LOGNAME
See your operating system's technical documentation to find out what  
variables are available.
You can also create your own environment variables by prepending the  
$ character to the
new environment variable's name:
   put field 3 into $MYENVVAR

This I can use to mimic a kind of "global" variable system without  
having to scour the 450,000+ lines of code for variable names and  
then declare all of them as global at the head of every script that  
uses them.

Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

More information about the Use-livecode mailing list