Sign in to follow this  
Followers 0
Phaser

Select an array from a list

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Malkey

Share this post


Link to post
Share on other sites

Thanks Malkey that seems to work thanks for the help

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Phaser

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by Malkey

Share this post


Link to post
Share on other sites

Thanks you, that again seems to work, will let you know if I find something else, cheers

Share this post


Link to post
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
Sign in to follow this  
Followers 0