Types within types issues

Blitz3D Forums/Blitz3D Beginners Area/Types within types issues

Hi,

I am attempting to use blitz's "type" functions to create types within types. This works very well, until I attempt to access individual types within each parent type. I believe it has something to do with the way I am reading back the data within the for / next loops.

Here is a simple example:

<b>
Type children
Field name$
End Type

Type parents
Field name$
Field child.children
End Type



;parent steve
parent.parents = New parents
parent\name$="steve"
parent\child = New children
parent\child\name$="steve/julie"
parent\child = New children
parent\child\name$="steve/justin"


;parent bob
parent.parents = New parents
parent\name$="bob"
parent\child = New children
parent\child\name$="bob/mike"
parent\child = New children
parent\child\name$="bob/stacie"





For parent = Each parents
Print parent\name$
For parent\child = Each children
Print " "+parent\child\name$
Next
Next
<b>


When I execute this code, each parent contains 4 children. Apparently the 'For parent\child = each children' bit is looping through each parents child and returning everything. All i want is the specific parents child.

I attempted to 'For parent\child = each parent\child\children' but this did not work. Any suggetsions would be greatly appreciated :)