let me rephrase that

Dar Scott dsc at swcp.com
Tue Feb 24 08:22:09 EST 2004


On Tuesday, February 24, 2004, at 05:54 AM, Thomas McGrath III wrote:

> What does nested mean to me?

Still on bugzilla wish list as multidimensional arrays.

> What would it benefit me to have it appear multidimensional?

See below.

> The most important thing that seems to make sense to me right now is 
> the benefits of using a reference name that makes sense.
> I like that. It might make things a lot easier to read.
>
> Dar, since I have a dozen items in each line that refer to each button 
> that is a lot of keys and I can see how it would apply BUT since I 
> have hundreds of button graphics each with dozens of lines ARE they 
> separate arrays? Then how to manage the separate arrays.
> Or is it part of the same array? like in xml where each is a new main 
> key and then the dozen item keys..?????

Suppose you have several projects, "Let hair grow long", "Scrub 
reactor", "Learn Attic Greek".  Each project has a "Goal Description", 
"Log", "Target Date", and optionally "Mascot".  To make a virtually 
multidimensional array, use the comma operator to build a single 
dimensional key.  Like this:

   Put "Cool Ponytail!" into projects["Let hair grow long","Goal 
Description"]

> Instead of line 20 item 1 and item 2 to check it would be the keyname 
> of (button 20) and check its button 1 and button 2 states to act upon.

An alternative is to put the attributes of each project into items of a 
string.  Perhaps you can define functions and handlers to get or set 
each attribute, given the project value:

function getGoalDescription projVal
    return item 1 of projVal
end getGoalDescription

handler setGoalDescription @projVal goalDescription
    put goalDescription into item 1 of projVal
end setGoadDescription

function getGoalDescriptionFromArray projName
    return getGoalDescription(projects[projName]
end getGoalDescriptionFromArray

Dar Scott



  
  



More information about the use-livecode mailing list