holidng another variable name within a variable

Richard Gaskin ambassador at fourthworld.com
Thu Jun 14 14:44:25 CDT 2012


dunbarx wrote:

 > The instances where this is needed were learned by experience,
 > frustration and luck.
 >
 > Same with embedded text, a variable within a variable, so to speak.
 > You must evaluate twice, as you did by longhand, or use a "do"
 > construction for brevity.

When you need variable variables arrays are a natural fit.

The workarounds we all learned were only because HC didn't support 
arrays.  But now that we have them, we can make general-purpose 
containers for any number of values stored by any name.

So instead of the funky:
   do "put" && myText" && "into" && the foundChunk --or somesuch

...we can simply write:

  put myText into tMyGeneralPurposeDataStore[someLabel]


--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys



More information about the use-livecode mailing list