fun with arrays

BlitzMax Forums/BlitzMax Programming/fun with arrays

Curtastic(Posted 2005) [#1]
it actually makes the arrays the size you enter!
so it just puts your array-size code into the new method?
if you add the new method, it doesn't compile and points to field a[
Strict
Type t
	Field b
	Field a[ Int(Input()) + moo(Self) + b]
	'Method New()
	'	Print "hi?"
	'End Method
EndType
Local i:t=New t
Print "length is "+i.a.length
Print i.a[1]
Print i.a[9]
Print
Local j:t=New t
Print "length is "+j.a.length
Print j.a[1]
Print j.a[9]

WaitKey
End

Function moo(z:t)
	z.b=2

	Print "MEEEEERRRR"
	'Print z.a[1] 'that cant be good
	'z=New t 'that is just bad
	Return 1
End Function



Robert(Posted 2005) [#2]
It does not compile at all here - Replace the b]] with b] in the declaration of Field a, then it ocmpiles with or without new commented out.