wese85 Posted July 7, 2021 Share Posted July 7, 2021 #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 ($Data[1])[1] = "gar" _ArrayDisplay($Data[1]) Hello, does anyone have any idea why this array cannot be changed. thanks in advance Link to comment Share on other sites More sharing options...
Nine Posted July 7, 2021 Share Posted July 7, 2021 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 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
wese85 Posted July 7, 2021 Author Share Posted July 7, 2021 thx Link to comment Share on other sites More sharing options...
JockoDundee Posted July 8, 2021 Share Posted July 8, 2021 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now