Tlist arrays
BlitzMax Forums/BlitzMax Programming/Tlist arrays
| ||
Global TfoodlistArray : Tlist [rows,colums]; Local a,b:Int For a=0 To rows For b=0 To colums Tfoodlistarray[a,b] = CreateList(); Next Next thats what I am trying to do atm. rows, and colums : int = 11. So I should have a set of 12*12 lists. It compiles, but it seems to bomb out as soon as I try to drop anything into one of the lists. |
| ||
Hmm, this seems to work If I increse the arraw size by 1 on each variable. I guess this means I now have 24 lists in the array that are not being used? seems strange to me that id have to do that so let me know. until some one points out what im doing wrong I will keep coding while its working. lol. |
| ||
The number in the brackets is the number of "elements" to allocate for an array. Since elements are indexed beginning with 0, then the last element would be indexed at one less than the number of elements.Local MyArray:int[4] 'create 4 elements MyArray[0] = 0 'Access first element MyArray[1] = 1 'Access Second element MyArray[2] = 2 'Access Third Element MyArray[3] = 4 'Access Forth Element So no, you don't have 24 extra lists. If row = 11 and column = 11, thats an array of 11*11 lists, indexed from 0 to 10. |