HyperCard: Global/Local Variables



Is there a way within HyperCard to retrieve and/or set a local variable for
handler "xyz" from handler "abc"?

I don't want to make everything a global variable and have them initialized as
the stack is opened.

What you want to do is not possible. However, there are a number of ways to
"fake" global-local variables.

You could create one global variable (in this example, "holdEm") containing
many items.

For example:

put "1,5.67,fred,in,0,,rain" into holdEm

stores seven items in the variable named holdEm. To avoid a lot of messy
initialization, the information in the variable could be saved in a field:

put holdEm into field storeVars

and restored to the variable when the stack opens:

put line 1 of field storeVars into holdEm

This is much faster than seven put statements.


Published Date: Feb 18, 2012