Arrays as function parameters
BlitzMax Forums/BlitzMax Beginners Area/Arrays as function parameters
| ||
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 |
| ||
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 |
| ||
You might find that converting an array to a list inside the function gives you more flexibility. |
| ||
Hmm, yes I think it would, I'll try that. Thanks |