Opened 4 years ago

Last modified 4 years ago

#3515 new Feature Request

Assigning directly a value to an element of an array in array

Reported by: j0kky Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: array in array Cc:


If you want to assign a value to an element of an array contained in another array, you should use another function with a ByRef parameter, it could be useful if we could assign directly that value, this is an example that works:

Local $a[3] = [1, 2], $b[3] = [3, 4]
$a[2] = $b
ModArray($a[2], 2, "Test")
ConsoleWrite(($a[2])[2] & @CRLF)

Func ModArray(ByRef $aArray, $iElement, $value)
    $aArray[$iElement] = $value

If I try to assign directly the value writing

($a[2])[2] = "Test"

I get the error:

Statement cannot be just an expression.

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by Jos

That error comes from au3check, not autoit3.
Don't think this format is supported anyways and doesn't work when ran without au3check.


comment:2 Changed 4 years ago by j0kky

It could be useful if the syntax:

(array)[element] = value

was accepted by Au3Check and correctly parsed by AutoIt3.
In fact, it will be useless for simple arrays, but it will be fundamental for array in array.

By now, the syntax


is accepted only for reading values and this code returns the same error too:

Local $a[2]
($a)[0] = 1

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 new 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.