global TYPE arrays

BlitzPlus Forums/BlitzPlus Programming/global TYPE arrays

The first example displays 1000 in the debuglog.
But I had to add a Stop at the end so I could see it.

Your type within a type example should work.
Just remember that you still have to create the subtypes with New.
Graphics 250, 150, 0, 2

Type main
	Field n
	Field s.sub
End Type

Type sub
	Field x
End Type

Global m.main  ; now variable m exists, but does not point to an object

If m = Null 
	Text 10, 10, "m is Null"
End If

m = New main  ; m\n initialized to 0, m\s to Null

Text 10, 50, "m\n = " + m\n

; Here m\s is just a Null pointer...

m\s = New sub  ; now m\s actually points to an object

m\s\x = 12345

Text 10, 90, "m\s\x = " + m\s\x

WaitKey
End