Cast Object to Array?
BlitzMax Forums/BlitzMax Programming/Cast Object to Array?
| ||
I can pass an Array as an Object function parameter: Function myFunction(arr:Object) 'what goes here? End Function Local myArr:Int[2] myArr[0] = 12 myArr[1] = 13 myFunction(myArr) But how do I access the array? Thanks. |
| ||
Surprisingly, it works just like any other cast :SuperStrict Function myFunction(arr:Object) Local array:Int[] = Int[](arr) Print array.length Print array[1] End Function Local myArr:Int[2] myArr[0] = 12 myArr[1] = 13 myFunction(myArr) BlitzMax is cool :-) |
| ||
Thanks. I thought I'd tried that, but obviously not. :) |