Jump to content

change stringsplit array


Recommended Posts

You cannot assign new value like that.  You can retrieve it with the way you use, but cannot set it.

One way :

#include <array.au3>

Global $Data[2]
Global $test[2] = ["hello,test,yes","no,bu,zam,xod"]

For $n = 0 To 1
  $Data[$n] = StringSplit($test[$n],",")
Next

SetArray($data[1], 1, "gar")
_ArrayDisplay($Data[1])

Func SetArray (ByRef $aArr, $iIdx, $vVal)
  $aArr[$iIdx] = $vVal
EndFunc

 

Link to comment
Share on other sites

Pretty sure this is a bug.

Assigning a value to expression should return an error, lest one think that some variable is actually being modified somewhere.

In its purest form it doesn’t even involve arrays, for instance:

Local $a=1, $b=2

($a) = $b

ConsoleWrite($a)

The second statement should throw an AutoIt error, something to the effect of 

Cannot assign value to an expression.

 

Code hard, but don’t hard code...

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