Array in functions and 'Step' Constant

Blitz3D Forums/Blitz3D Programming/Array in functions and 'Step' Constant

splinux(Posted 2005) [#1]
1] how can i pass an array to a function [if it's possible] ?
2] there is a way to use a variable with 'Step' command, example:

...
For i% = 1 To FINISH% Step VAR%
...
Next
...


Beaker(Posted 2005) [#2]
You can pass Blitz arrays like this:
Local myArray[5]

myFunction(myArray)

Function myFunction(thisArray[5])
;blah
End Function


The only way to replicate a STEPped variable is to use a Repeat or While:
i% = 1
While i <= FINISH%
;blah
i = i + VAR%
Wend



WolRon(Posted 2005) [#3]
In case you aren't aware, normal arrays () are global and don't need to be passed to functions.


splinux(Posted 2005) [#4]
1] thanks
2] how can i make multidimensional arrays?:
Global ar[5, 2] and Global ar[5][2] don't work...


splinux(Posted 2005) [#5]
i read it's impossible create multidimensional array(BlitzArray[tm]), but how can i use a multidim. array as parameter in a function???


jfk EO-11110(Posted 2005) [#6]
dim space3d(10,10,10)

Wolron, of course there are several situations where you want to send an ARRAY handle to a function in case you have multiple arrays that could be used by the function.

SpLinux - you can always use a bank instead of an array, In fact, since arrays (unless they are strings) are simple 4 Byte lists (both int and float), using banks instead of arrays is trivial - and allows to hand over the bank handle.


splinux(Posted 2005) [#7]
thanks.


WolRon(Posted 2005) [#8]
Wolron, of course there are several situations where you want to send an ARRAY handle to a function in case you have multiple arrays that could be used by the function.
I know...