array dimensions

BlitzMax Forums/BlitzMax Programming/array dimensions

rdodson41(Posted 2005) [#1]
In my prgm, one function has an array passed in as a parameter. Is there anyway to find out the dimensions of the array without having extra variables? Such as ArrayWidth(m:Int[]) or ArrayHeight(m:Int[]). Is this possible?


Perturbatio(Posted 2005) [#2]
len(myArray[])

or I believe you can do:

myArray.Length

*EDIT*
if you are using the arrays within arrays trick then you can get both width and height with this.


John-D(Posted 2005) [#3]
Maybe a silly question but I'm new here :) No multidimensional arrays? Ok, so I know I can use a one dimensional array and some simple arithmetic, or even a list. Sometimes, though, you just can't beat map[x][y] :)

Am I missing something?


tonyg(Posted 2005) [#4]
There are multi-dimensional arrays.
From the Wiki...
http://www.peppermedia.net/blitzwiki/index.php/Arrays#Multi-Dimensional_Arrays


John-D(Posted 2005) [#5]
Ngggggg

Thanks for that :)


Tom(Posted 2005) [#6]
Undocumented:

Local a:Int[2,2,2]
Print a.numberOfDimensions 'Prints 3


Perturbatio(Posted 2005) [#7]
Also undocumented:
Local a:Int[2,2,2]
Print a.numberOfDimensions 'Prints 3 
Print a.elementTypeEncoding[0] 'Prints 105 if Int, 102 if Float, 36 if String
Print a.sizeMinusHeader