At 20:35 +0000 03/08/2002, Nmuta Jones wrote:
nMuta, are you aware you're CCing grimmwerks in your notes? That's
probably not strictly required, as he's subscribed to Lingo-L
already. ;)
>OK I have narrowed the problem down to its simplest form.
>
>where gturn is a variable for the turn of a current player,
>
>Director will recognize
>
>put ginventorylist[gturn].fish
>-- (fish is a property in the proplist)
>
>but it WONT do
>put ginventorylist[gturn].ganimal
>-- (ganimal is a variable that is "fish" in this instance)
>
>-- in other words, I can put a variable as part of the list name,
>but not for the property , because that part cannot take a string.
>it sees the quotations and it doesn't work. how to I convert the
>ganimal variable into a symbol so that I can use it this way? or is
>there a better way to do this.?
You want to use the var's contents to access a sub-property of the list?
Why not do
put ginventorylist[gturn][ganimal]
instead?
To convert a string to a symbol, use the symbol() filter. Note this
truncates at any non-alphanumeric, so punctuation, spaces, etc. won't
work. To convert back to string, use string(). Thus:
put symbol ( "Howdy" )
-- #Howdy
put string ( #Tzi )
-- "Tzi"
put symbol ( "Howdy-tzi" )
-- #Howdy
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]