Passing array to function

Blitz3D Forums/Blitz3D Beginners Area/Passing array to function

Jeroen(Posted 2003) [#1]
Hi, I try to call a function like this:

displayArray(map,4,4)


But it is not allowed.
This is the function:

Function displayArray(whichArray,amountX,amountY)
For y = 0 To amountY
For x = 0 To amountX
Text x*20,y*20,whichArray(x,y)
Next
Next
End Function




How should I call the function and/or type the head of the function?

Thank you.


soja(Posted 2003) [#2]
An array cannot be a function parameter. (The exception is a "BlitzArray", using [] -- search the forums for it.)

Since arrays are global, you can use it in the function, but you can't pass it in as an argument.


Jeroen(Posted 2003) [#3]
thanks! Its weird Blitz has two types...seems unneccesary :(


podperson(Posted 2003) [#4]
I'd also point out that each type effectively comes with a dynamic array and that this tends to obviate the need to pass arrays around (or use arrays much).


soja(Posted 2003) [#5]
...each type [of array] effectively comes with a dynamic array...

What does this mean? I don't understand.