About variable.

Trevor DeVore lists at mangomultimedia.com
Thu Mar 31 14:56:58 EST 2005


On Mar 31, 2005, at 11:29 AM, Ken Ray wrote:
>
> However with that said, I use a mixture of globals and custom 
> properties and
> I'm migrating more of my "global use" to custom properties as time goes
> on...

Another method that you can use rather than globals or custom props is 
a "state" library stack.  I used custom properties to store the current 
state of the app when I first started using Rev (I don't care for 
globals personally).  What I didn't like about this approach was the 
long syntax to refer to the custom prop, especially when referring to a 
prop in another stack.  I never save the application stack (I used 
separate data stacks stored in the user space) so the ability to save 
custom props with the stack didn't add any value.

What I do mpw is create a stack called "datainterface" which I put into 
use when the app starts up.  This has calls similar to this:

getID()
setID
getDataFolder()
setDataFolder
etc..

The stack has local variables declared where the values are stored -

local sIDsA			--> ARRAY OF IDS
local sDataFolder	--> FOLDER WHERE APP STORES DATA FILES

I just initialize these values when the app starts up and they are 
available until the app quits.  I can now get the app state variables 
with a simple call from any script in the app.  I like this more than 
globals since I can validate data and don't have to declare them in 
every script.  I like it more than custom props since the syntax is 
shorter.  It works well for me.


-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com



More information about the use-livecode mailing list