Passing subtypes as Function parameters

Blitz3D Forums/Blitz3D Programming/Passing subtypes as Function parameters

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

To date I've been using an array of Joints() and an array of Objects(). I realized it'd be smarter to consolidate the two, so the Object class now has a joint field...
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\pos.vector=NEW vector
NEXT

Only now my function create_joint doesn't work.
FUNCTION Create_Joint(j.joint)
   IF j\joint_type
      blah blah blah
   END IF
END FUNCTION

The object 'j' = Null ; it hasn't been created when called with Create_Joint(objects(n)\joint)

How do I pass the joint sub-object as a function parameter?