Variable with multiple arguments
Blitz3D Forums/Blitz3D Beginners Area/Variable with multiple arguments
| ||
I remember with BlitzBasic on Amiga I had something like that, but I didn't find it in the manual: a$(x,y)=? x and y would be a variable that specifies my position, and each combination would be able to store a different variable. Thanks. |
| ||
const MaxX = 100 const MaxY = 100 Dim a$( MaxX-1, MaxY-1 ) a$( 0, 10 ) = "Blah Blah" a$( 5,75 ) = "Etc..." |
| ||
When compiling I obtain: Identifier dim not found. |
| ||
Have you used Dim somewhere else as a variable? Dim is a standard Blitz command to declare arrays, it would be very strange that the compiler wouldn't recognize it as a command. Just tried the example given by Stevie G and that compiles correctly without errors. |
| ||
Strange. I was try the code snippet and runs without error. |
| ||
Can you post a snippet of how you are using this, Seb, so we might be able to see what's giving you the error? |
| ||
I'm using BlitzIDE on a Mac, maybe there's a problem with this version. Very strange. |
| ||
I'm using BlitzIDE on a Mac, maybe there's a problem with this version. Very strange. Blitz3D doesn't run on a Mac. Are you in the wrong forum? |
| ||
On BlitzMax you would write no round brackets:const MaxX = 100 const MaxY = 100 Global a$ [ MaxX-1, MaxY-1 ] a$ [ 0, 10 ] = "Blah Blah" a$ [ 5,75 ] = "Etc..." |
| ||
Sorry, bad forum. But the Dim command should be a common command I think, am I wrong ? |
| ||
Nah, BlitzMax does it with Local/Global. From the docs:Local int_array[10] Local int_array[] Local int_array:Int[] int_array=New Int[10] ...are various ways to do it. You can do something cosmetically similar in Blitz3D, although it functions in pretty much the opposite way and isn't quite as useful. |