Ok, lets see if I read the code correctly...
Example 1: Ball Bat
Lets say it does 40 damage on a hit, type is stun. I hit a target with armour 20, so 20 actual stun damage is dealt. Now the Ball Bat has "ToHealth=0.75", so in addition to the 20 stun damage the bat does 20*0.75=15 damage to health.
Example 2: Plastersteel Pipe
Lets say it does 30 damage on a hit, type is concussion (type 3, HE in vanilla). I hit a target with armour 20, so 10 damage to health is dealt. Now the pipe has "ToStun=1.5", so in addition to the 10 damage to health the pipe should do 10*1.5=15 stun damage. But since "ToStun" is rolled, it does 0-15 stun damage, so an average of 7.5.
Edit: If I read the code correctly, "ToStun" ignores any stun resistances the target might have if it's not totally immune to stun damage. Also, no resistances in the "ToHealth" damage, and no bleeding.