Arrays as function parameters

BlitzMax Forums/BlitzMax Beginners Area/Arrays as function parameters

KrayzBlu(Posted 2005) [#1]
I'm trying to create a function to save me some time, to take an array, and insert some data into a newly created slot.

However, I'm having trouble using arrays as a parameter/input source, and returning seems just as difficult. Are there any tips/tricks for this? IE should I use square brackets or not? Niether seem to work :/


Thanks


Beaker(Posted 2005) [#2]
This works:
Strict

Local myarr[5]

myarr = [22,32,15,100]
myarr = changeArr(myarr)
Print myarr[9]
End

Function changeArr[](anyarr[])
	anyarr = anyarr[..10]
	anyarr[9] = 105
	Return anyarr
End Function



Beaker(Posted 2005) [#3]
You might find that converting an array to a list inside the function gives you more flexibility.


KrayzBlu(Posted 2005) [#4]
Hmm, yes I think it would, I'll try that.

Thanks