creating and storing multidimensional arrays

James Hale james at thehales.id.au
Tue Jan 6 23:45:19 EST 2009


Hi,

I am trying to understand multidimensional arrays in a structural sense.

I am thinking of them along the lines of a database record (row) and  
want the array to have the following structure:

key, word, wordlength, linenumber, position, reference

in other words each row (given by "key") of the array will contain the  
six values " word, wordlength, linenumber, position, reference"

If I have created what I think is a multidimensional array using the  
code snippet below:

where say "index" = 23

put "fred" into wArray1[index]["theword"]  -- The word in question
put 4 into  wArray1[index]["wlength"]    -- its length
put 6 into  wArray1[index]["theline"]  -- the line containing the word
put 24 into  wArray1[index]["theoffset"]  -- the character position  
word starts
put "T1.2"  into wArray1[index]["theRef"]  --its reference

Is this a multidimensional array?

If it is I am thus thinking "in effect" that wArray1[23]= "fred" 4 6  
24 "T1.2"

If it is, how can I store this array in a custom property?

Will a line such as "set the customProperties["cpWordarray"] of this  
stack to wArray1" store the whole array?

Note: I will eventually store it in a database, this is simply a temp  
storage location while I work out the scripting between sessions.

James Hale

james at thehales.id.au

Tel: +61 3 9386 2516
Fax: +61 3 9386 1387






More information about the use-livecode mailing list