Ken Norris wrote:
Hi Gordon,

On Nov 30, 2004, at 2:25 AM, [EMAIL PROTECTED] wrote:

Date: Mon, 29 Nov 2004 20:39:49 -0800 (PST)
From: Gordon <[EMAIL PROTECTED]>
Subject: Reusable Code (again)

Sorry, I meant to ask for a variable example, not a
constant. My question is this then ...

How do I have my reusable stack introduce a global
variable that can be passed around in an application
that uses the stack? Can I declare a global variable
in the stack script of the reusable stack and then use
the 'start using' construct that was described
earlier?

Does this avoid having to declare the same global
variable in the rest of my app?


I think you're making it too hard. Store it in custom props instead, call it via path from wherever you are.

Or use a function, which adds only two characters:

 function:   get myValue()

 global var: global gMyValue
             get gMyValue

 property    get the uMyValue of stack "Props"


Function calls carry a bit of overhead relative to the others, but its just a few nanoseconds and if you need to use the value often in your script yoiu can just copy it to a local var:


  put myValue() into tMyValue
  repeat with i = 1 to 100000
     add tMyValue to tTotal
  end repeat


-- Richard Gaskin Fourth World Media Corporation ___________________________________________________________ [EMAIL PROTECTED] http://www.FourthWorld.com _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to