Newsgroups: comp.sys.mac.hypercard
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!zardoz.cpd.com!dhw68k!mrx
From: mrx@dhw68k.cts.com (Mark Murphy)
Subject: Re: Variables in a list?
Message-ID: <1991Apr2.183107.25974@dhw68k.cts.com>
Organization: Wolfskill & Dowling residence; Anaheim, CA (USA)
References: <4165@ac.dal.ca>
Date: Tue, 2 Apr 91 18:31:07 GMT

In article <4165@ac.dal.ca> ireland@ac.dal.ca writes:
>Can variables be put into a list and then referred to as items in that
>list? I'd like to be able to do the following:
>
>on foobar
>  global G1,G2,G3
>  put "G1,G2,G3" into myList
>  put 77 into item 2 of myList
>end foobar
>
>I'd like the value of G2 to be set to 77. Unfortunately, all the above
>does is replace G2 with 77 in myList. Being able to do something like
>this would be an elegant solution to a scripting problem I have.
>Anyone know how to do something like this?
>

   Try this.....

on foobar
  global G1,G2,G3
  put "G1,G2,G3" into myList
  do "put 77 into" && item 2 of myList
  put 77 into x
  do "put" && quote & x & quote && "into" && item 2 of myList
end foobar

   If you are using HC 2.0, you can do entire scripts with the 'do' command... including 
including conditional statements.


-- 
+-----------------------------------+----------------------------------------+
| Real Life: Mark F. Murphy         | What kinda beer do you like?           |
|   The Net: mrx@dhw68k.cts.com     | Heineken!?  Intercourse that doo-doo!! |
| The Desktop BBS: 714-491-1003     | Pabst Blue Ribbon!!!                   |
