Was chainmail invented before or after plate armour? Was it only really used to protect the exposed parts of plate armour? Was it able to protect against sword swings and thrusts or was it just a deterrent against stray cuts?
Chainmail was definitely invented before medieval plate armour, and was the big thing in protection for several centuries, the peak being the 11-13 th centuries. A well made maille armour can protect you from nearly everything you'd encounter on the battlefield at that time. It is basically immune to sword cuts, it handles thrusts and arrows pretty well. However it did not protect that well from blunt trauma - axes and hammers for example. Usually maille would be worn with a thick tunic, kaftan or gambeson, to help with the blunt trauma and to add some additional protection. Overall maille was very useful and it did its job pretty well - after all you don't get to see battlefield use for more than 2000 years if you're ineffective
As already mentioned chainmail predates plate armour by quite a bit. Plate armour as we consider it (meaning medieval plate as opposed to Roman armour that used plates) didn't appear until after 1300. The use of chain mail to protect gaps in plate armour was actually short lived and quickly fell off as plate armour became more advanced. There are some exceptions, chain mail collars hanging from helmets remained even if they weren't necessarily commonplace, but generally they passed out of favor since wearing both chain mail and plate armour was quite heavy and unwieldy.
The exact properties of chain mail are hard to say for a couple of reasons. First we don't have a plethora of surviving medieval chain mail to study to know exactly what it was built like. It makes a significant difference if the rings are made of hardened steel or if they are simply iron, for instance. It seems that chain mail was often patched up when parts of it broke and then passed on to future generations so it rarely survives in its original state (or at least that's one theory of why we have so little of it).
Chain mail would definitely protect against slashing weapons and would even provide okay protection against bludgeons as the mesh would disperse some of the blow's impact. Against thrusts the record is less clear. If we look at written sources there are accounts of knights being shot full of arrows while wearing chain mail and surviving unscathed and there are accounts of knights being shot once and the arrow going straight through the mail. Modern replica tests suggest that what was worn underneath the mail could make a huge difference but we often don't know what specific materials were used to make underclothes for mail.
Chain mail was the default armour of the knight for nearly a thousand years so it had to have something going for it. It's sometimes cited as one of the great advantages the Crusaders had over their Muslim counterparts during the First Crusade.