Jump to content
Sign in to follow this  
Bigglesw0rth

For...to..next $Var Within An Array?

Recommended Posts

Bigglesw0rth

So I am probably going about this wrong, so I thought I'd ask.

Basically I have have a simple array at the top of my page:

Global $_Field7[2] = ["Dog", "Cat"]

And later I have a button made that runs this for..to loop:

For $ii = 7 to 14
_FieldCreation($_Field[$ii][0], $_Field[$ii][1])
Next

I try to run it and it keeps saying that it is not declared. I wanted it to work like the $ii going into $_Field[1] so it would look like $_Field7[0] and $_Field7[1] . And that would be declaird, so obviously im not getting the '7' from the $ii in there correctly. What should I do to get it to work so that the $ii is put in correctly so it outputs the already declared variables?

Thanks

Edit: Do I need to create a new array and place my smaller arrays inside? Or is there a way to put two variables together to create a new variable?

Edit#2: Looks like I should just put everything inside one large array. Id still like to know if i can combine two vars into a new already declaired var, and if there is just a better method than this. Thanks for reading my crazyness.!

Edited by Bigglesw0rth

Share this post


Link to post
Share on other sites
bogQ

you have 1D array declared and using 2D in loop

1D=[0]

2D=[0][0]

look at

Example 4 for _ArrayDisplay

and note that you don't have enough elements in there to loop $ii = 7 to 14

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Bigglesw0rth

Ahh, thanks I get how 2D arrays work now. First part is 'sets' and the second is number of 'elements' in each set?

Awesome!

Edited by Bigglesw0rth

Share this post


Link to post
Share on other sites
Unsigned

Ahh, thanks I get how 2D arrays work now. First part is 'sets' and the second is number of 'elements' in each set?

Awesome!

Yep. An alternate way is to think of it as X and Y coordinates on a two-dimensional matrix. But you've got the idea. :graduated:

.

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  

×