[Gambas-user] gb3: 2D array of 1D Integer arrays

Benoît Minisini gambas at ...1...
Mon Aug 8 22:29:53 CEST 2011


> On 08/08/2011 04:10 PM, Benoît Minisini wrote:
> >> I asked this before and didn't get a response. Maybe I gave too much
> >> background information and made the problem appear more complex than it
> >> is.
> >> 
> >> I need to create a 2D array of 1D Integer arrays.
> > 
> > You should write it that way:
> > 
> > "a 2D array of 1D array of integers".
> > 
> > Then you write it in Gambas from right to left:
> > 	Integer[x][y, z]
> > 
> > In Gambas a 2D array, a 1D array, a XD array are all arrays. So the
> > datatype is 'Integer[][]'.
> > 
> > 	Dim MyStrangeArray As Integer[][]
> > 	
> > 	MyStrangeArray = new Integer[][SizeX, SizeY]
> > 	
> > 	MyStrangeArray[X, Y] = New Integer[SizeZ]
> > 
> > Is it clearer ?
> 
> I think I got it. :) I did this as you suggested:
> 
> Public tTileGrid As Integer[][]
> 
> tTileGrid = New Integer[][TileGrid.Size, TileGrid.Size]
> 
> For counter2 = 0 To TileGrid.Size - 1
>    For counter1 = 0 To TileGrid.Size - 1
>      tTileGrid[counter1, counter2] = New Integer[1]
                        T
                        |
That line is useless ---'

Gl.GenTextures() creates the array for you, and that array will replace the 
array that you just have created for nothing.

Regards,

-- 
Benoît Minisini




More information about the User mailing list