Passing arrays as perameters to a function

Blitz3D Forums/Blitz3D Beginners Area/Passing arrays as perameters to a function

Cousin Gilgamesh(Posted 2005) [#1]
is there a way to pass an array as a perameter to a function? It would be really great if someone would tell me how... thanks a lot.


n8r2k(Posted 2005) [#2]
Well that depends on what u want to do. You could do something like this:



And that would assign the variable using a function.


GfK(Posted 2005) [#3]
You don't need to pass arrays to functions. Arrays are always global so you can access them from within functions anyway.


n8r2k(Posted 2005) [#4]
Oh yeah. I forgot about the global part and I thought that you didnt need to pass them to functions but i didnt want to burst anyones bubble


Beaker(Posted 2005) [#5]
This has been covered a million times before, but..

You can pass 'blitz' arrays to functions, like this:
Local a[20]

blah a
Print a[10]
End

Function blah(b[20])
	b[10] = 501
End Function

Note that they are single dimensional and cannot be resized, but you can store them in Type objects:
Type thing
Field a[20]
End Type



Cousin Gilgamesh(Posted 2005) [#6]
thanks