Opened 12 years ago

Closed 12 years ago

#2283 closed Bug (No Bug)

Array access when using nested arrays

Reported by: Mat Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:


If arrays are nested then it is not possible to access them using brackets directly.

Local $a1[3] = [0, 0, 0]
Local $a2[3] = [1, 2, 3]

$a1[2] = $a2

;MsgBox(0, "Test", ($a1[2])[1]) ; Works
MsgBox(0, "Test", $a1[2][1]) ; Doesn't

Furthermore, using parenthesis like above to try and assign to that does nothing at all (no error, no effect):


Local $a1[3] = [0, 0, 0]
Local $a2[3] = [1, 2, 3]

$a1[2] = $a2

($a1[2])[1] = 42


Attachments (0)

Change History (1)

comment:1 Changed 12 years ago by trancexx

  • Resolution set to No Bug
  • Status changed from new to closed

That's how it's supposed to be, because that's how array access is docummented to be.
If former would work there would be no way to make distinction between nested 1D array and regular 2D array, which would be wrong.
Latter is ok too. The line of your code before the last one is stateless expression which evaluates to False, meaning it's not an assignment.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.