Biggest moron in the world, but...

BlitzMax Forums/BlitzMax Beginners Area/Biggest moron in the world, but...

Hi,


Global speelveld:Int[8,12]

GeneratePlayField()
Print speelveld[1,1]

Function GeneratePlayField()

Local x:Int
Local y:Int

For y = 1 To 11
For x = 1 To 7
speelveld[x,y] = Rand(4)+1
Next
Next

End Function

Gives me a nice error message: Expressio of type int cannot be indexed..

wtf am i not seeing?
If i declare a global array (or any other var for that matter) i should be able to use it inside procedures?

Please help, and don't RTFM me, because i just can't seem to find it :(

Regards, Michel.

I tried the code and it compiled just fine.

odd, works for me...

oops, forgot to mention the function is IMPORTed.
Could that be of importance?
Do i have to do something extra if i use import instead of include?

Did you put "Strict" at the top of your file?
Seems like BlitzMax didn't find your array and simply "auto-declared" it to the default type (integer). And for sure you can't index an integer.
So put a "Strict" and see if it's not simply failing to find your global array, for whatever reason.


oops, forgot to mention the function is IMPORTed.
Could that be of importance?
Do i have to do something extra if i use import instead of include?


The Global speelveld:Int[8,12] needs to be in the same file as the function if the function is imported.

If you import a file you should be able to press F5 on that file and it should compile by itself.

Thanks for all the reply's, i use Include and it works fine.
Still strange that the helpfile does not mention this strange behavior...