Modify ↓
Opened 13 years ago
Closed 13 years ago
#2283 closed Bug (No Bug)
Array access when using nested arrays
| Reported by: | Matt Diesel | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.9.4 | Severity: | None |
| Keywords: | Cc: |
Description
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):
#include<Array.au3> Local $a1[3] = [0, 0, 0] Local $a2[3] = [1, 2, 3] $a1[2] = $a2 ($a1[2])[1] = 42 _ArrayDisplay($a1[2])
Attachments (0)
Note:
See TracTickets
for help on using tickets.

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.