Passing and returning arrays

BlitzMax Forums/BlitzMax Programming/Passing and returning arrays

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Thanks Alex. seem to have figured it out:

Function ArrayFiddler:String[](In$[])
   Local out$[]
   return out
End Function

Local myarray$[]
myarray = ArrayFiddler(myarray)


Now I know I could just modify the In array in the function and because it's passed as a var (isn't it?) it would remain modified after the function, but my function is pretty complex and it's easier to make a new array and pass that out.

Anyway another question arise. Will BMax garbage collection handle this line:

myarray = ArrayFiddler(myarray)

properly because the original myarray is now being overwritten, all the strings in the original one need to be freed and so does the original array. Will that be done? I hope so...