Biggest moron in the world, but...

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

Cloak(Posted 2005) [#1]
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.


deps(Posted 2005) [#2]
I tried the code and it compiled just fine.


RiK(Posted 2005) [#3]
odd, works for me...


Cloak(Posted 2005) [#4]
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?


Koriolis(Posted 2005) [#5]
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.


Curtastic(Posted 2005) [#6]

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.


Cloak(Posted 2005) [#7]
Thanks for all the reply's, i use Include and it works fine.
Still strange that the helpfile does not mention this strange behavior...