Passing subtypes as Function parameters

Blitz3D Forums/Blitz3D Programming/Passing subtypes as Function parameters

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

If you attempted to Create_Joint(objects(n)\joint) after the For...Next, n=11 therefor it is Null. You should try calling the function within the For...Next.

Type vector
	Field x#
	Field y#
	Field z#	
End Type

Type joint
   Field pos.vector
   Field joint_type
End Type

Type obj
   Field pos.vector
   Field size
   Field joint.joint
End Type

Dim objects.obj(10)

For n=0 To 10
   objects(n)=New obj
   objects(n)\pos.vector=New vector
   objects(n)\joint.joint=New joint
   objects(n)\joint\joint_type=n ;<-- a lil test
   objects(n)\joint\pos.vector=New vector
   Create_Joint(objects(n)\joint)
Next

WaitKey()

Function Create_Joint(j.joint)
      Print "jointtype="+j\joint_type
End Function