Passing array to function
Blitz3D Forums/Blitz3D Beginners Area/Passing array to function
| ||
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. |
| ||
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. |
| ||
thanks! Its weird Blitz has two types...seems unneccesary :( |
| ||
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). |
| ||
...each type [of array] effectively comes with a dynamic array... What does this mean? I don't understand. |