how exactly do you return blitz arrays?
Returning Blitz Arrays from Functions
Blitz3D Forums/Blitz3D Beginners Area/Returning Blitz Arrays from FunctionsGraphics 400, 300, 32, 2 ; Declaration Global a[2] a[0]= 1 a[1]= 2 a[2]= 3 ;------------------------------------ array_function(a) ; Show entries For cnt= 0 To 2 Text 10, (cnt+1)*15, a[cnt] Next WaitKey End ;------------------------------------ ; Important Funktion: Function array_function(temp[2]) temp[0]= 4 temp[1]= 5 temp[2]= 6 End Function
It seems that Blitz passes blitzarrays by reference:
when you're changing the values of the "temp"- array you're actually changing the values of the "a"-array.
You don't need to use any "Return" command.
(That's also new to me, never used blitzarrays that way)
Yea isn't that awesome? Very usefull
well, for one a[2] is global
second...my code tries to take two vectors (v[3] and f[3]) and return the resultant f2[3]
I might figure out a way to use what you were talking about to work around my problem...
EDIT:
I got it working!
For anyone else, the way you do it is to pass the array you want returned and simply do your calculations with the others and change the values of the "returning" array.
second...my code tries to take two vectors (v[3] and f[3]) and return the resultant f2[3]
I might figure out a way to use what you were talking about to work around my problem...
EDIT:
I got it working!
For anyone else, the way you do it is to pass the array you want returned and simply do your calculations with the others and change the values of the "returning" array.