HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

2 Dimensional arrays

10-22-2005, 09:38 PM#1
TaintedReality
Well, the title says most of it. Are 2 dimensional arrays possible? Would I need JASS? I've been making seperate arrays for each player atm, but it seems like it would be alot easier to just use a 2D array. Then I wouldn't have to use all the if statements to find which player did what, or waste my time copying everything 12 times ^^.
10-22-2005, 11:14 PM#2
Vexorian
2d arrays are impossible but possible.

what do I mean?

that you can always make a 1D array behave like a 2D array.

You only have to know what's the desired x or y size.

let's say we want an array that is [20][]

If x and y are the indexes of the 2D array you can use x*20+y to calculate the index of the 1D array that matches it.

In fact this is how ND arrays work in programming languages
10-23-2005, 12:00 AM#3
TaintedReality
oO never thought of that. Thanks, this will help a lot =D.