Multidimensional Field array init.

Monkey Forums/Monkey Programming/Multidimensional Field array init.

gekkonier(Posted 2012) [#1]
Is there any easier method to initialize a "multidimensional" array? I know Monkey does not support "real" multidim arrays, but arrays of arrays are no problem.
But the initialization is a quirks. Any faster, easier, better way here?

Strict

Class Test

	Field data:Int[2][]

	Method New()
		For Local i:Int = 0 To 1
			data[i] = New Int[2]
		Next
	End
	
	Method Bla:Int()
		data[0][1] = 15
		Return 0
	End
	
	Method Blubb:Int()
		Print data[0][1]
		Return 0
	End

End

Function Main:Int()
	Local t:Test = New Test
	t.Bla
	t.Blubb
	Return 0
End



muddy_shoes(Posted 2012) [#2]
Just write a function to do it.




gekkonier(Posted 2012) [#3]
Thank you!