Jump to content

Polydimensional Arrays


Recommended Posts

Okay so comming from PHP I'm used to named indexes and polydimensional arrays.

$cfg['proflile']['dateFormat'] = dd: mm: yy

That sort of thing, you also don't need to declare the number of slots per dim. It would dynamicly expand.

The issue I'm having is I don't want to assign more space then is required.

DIM $DATA[8]

Declares variable DATA[0] through DATA[7];

DIM $DATA[8][3]

Declares variable DATA[0][0]-[2] through DATA[8][0]-[2]

Now in my case DATA[4][n] requires 16 locations for data but was granted only 3.

How can I specify how many second level diminesions my arrays have?

DIM $DATA[8]
DIM $DATA[0][3]
DIM $DATA[1][16]
DIM $DATA[2][5]

Or do I just register the maximum I would need for any one slot and leave most of them blank? No mater how much of a waste of resources it is.

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

AutoIt does not have hashes built in, but see these threads for UDFs:

http://www.autoitscript.com/forum/index.ph...topic=11611&hl=

And no, you cannot have polydimensional arrays. Either dim the entire array to your maximum 2nd dimension, or make your own polidimensional handler, using an [x][2] array, where the 2nd column is a delimited string.

Link to comment
Share on other sites

Here's something I just discovered:

An array element can contain another array!

Dim $ArrayMain[8], $i
For $i = 0 to UBound($ArrayMain) - 1
    dim $aTemp[$i + 1]
    $ArrayMain[$i] = $aTemp
Next
$aTemp = $ArrayMain[3]
msgbox(0,IsArray($aTemp),UBound($aTemp))

Neat!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...