Array in functions and 'Step' Constant
Blitz3D Forums/Blitz3D Programming/Array in functions and 'Step' Constant
| ||
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 ... |
| ||
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 |
| ||
In case you aren't aware, normal arrays () are global and don't need to be passed to functions. |
| ||
1] thanks 2] how can i make multidimensional arrays?: Global ar[5, 2] and Global ar[5][2] don't work... |
| ||
i read it's impossible create multidimensional array(BlitzArray[tm]), but how can i use a multidim. array as parameter in a function??? |
| ||
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. |
| ||
thanks. |
| ||
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... |