There's more to it than that. When you create physics objects you need to let them settle a frame before adding joints to them.
The example first saves the offsets of the limbs from the body. Next it has a function to create the ragdoll at any location. The "wait 0" and "new" boolean are used as picking tricks to pick the container objects from a family. The "wait 0.1" is used to wait a few frames before adding joints.