Phaser Posted January 28, 2011 Share Posted January 28, 2011 Hi Guys I have a list of arrays Local $aarray[10],$barray[10],$carray[10] I want to use the following, or similar to select one of the above arrays to add to $theletter = "c" $lastletter = "a" $whicharray = $lastletter & "array" _ArrayPush($whicharray,$theletter,1) _ArrayDisplay($whicharray) $lastletter = $theletter In this example I would like arraydisplay to show me the content of $aarray which would contain c Any help appreciated many thanks Link to comment Share on other sites More sharing options...
Malkey Posted January 28, 2011 Share Posted January 28, 2011 (edited) Try this, #include <Array.au3> Local $aarray[10] = [1, 2, 3], $barray[10], $carray[10] $theletter = "c" $lastletter = "a" $whicharray = Execute("$" & $lastletter & "array") ; Copy an array to $whicharray _ArrayPush($whicharray, $theletter, 1) _ArrayDisplay($whicharray) Edited January 28, 2011 by Malkey Link to comment Share on other sites More sharing options...
Phaser Posted January 28, 2011 Author Share Posted January 28, 2011 Thanks Malkey that seems to work thanks for the help Link to comment Share on other sites More sharing options...
Phaser Posted January 28, 2011 Author Share Posted January 28, 2011 (edited) Ok its not doing what I expected #include <Array.au3> HotKeySet("{ESC}", "killit") Local $aarray[10], $barray[10], $carray[10] Local $counter = 0 $theletter = "c" $lastletter = "a" While $counter < 10 $whicharray = Execute("$" & $lastletter & "array") ; Copy an array to $whicharray _ArrayPush($whicharray, $theletter, 1) _ArrayDisplay($whicharray) $counter = $counter +1 WEnd Func killit() Exit EndFunc I expect it to keep adding the letter c so the whole array contains 10 c's, what am I doing wrong? Edited January 28, 2011 by Phaser Link to comment Share on other sites More sharing options...
Malkey Posted January 28, 2011 Share Posted January 28, 2011 (edited) $whicharray = Execute("{:content:}quot; & $lastletter & "array") ; Copy an array to $whicharray While $counter < 10 Swap the position of these two lines. The array, $whicharray is continually being set to the blank array, $aarray. Edited January 28, 2011 by Malkey Link to comment Share on other sites More sharing options...
Phaser Posted January 28, 2011 Author Share Posted January 28, 2011 Thanks you, that again seems to work, will let you know if I find something else, cheers 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