Riddle Me This... (Arrays & Banks Quirk?)
BlitzMax Forums/BlitzMax Programming/Riddle Me This... (Arrays & Banks Quirk?)
| ||
So, for my "Fished Max" project I'm using arrays of databanks to store map data. I kept encountering obscure bugs with an empty (i.e. all zero) map, with the program throwing out the error "Attempt to index array element beyond array length". However, when I loaded map data and did the same thing, no errors. I finally tracked it down to the fact that, even though my databank was full of zeros, if I manually fill the bank with zeros before I start, the errors don't occur. What. The. Heck...? |
| ||
can you post code? I have a feeling you are not initializing the values in the array. even though you declare an element as a specific type if the type is not created as a "new" type for each element of the array then you can't access it. but I am just guessing. Best if you post some code. |
| ||
Global map:TBank [8] map[0] = CreateBank:TBank( ((mapwidth+1) * (mapheight+1)) *4) This worked fine in Blitz+, incidentally... |
| ||
there is nothing wrong with it. It works fine in my computer(currently apple Ibook) I am shure you know that the index limit in your example is 0 to 7 right? |