Issue with Skeletal Animation

I am writing an IQE (IQM) model parser in Lua and I’m running into some issues. The loader itself seems to work fine and follows the IQE spec, even rendering the base model works wonderfully. The problem lies in trying to animate the model. When running an animation, the following happens:
As far as I can tell, the bone transforms aren’t properly taking into account the parent bone’s position, causing some weird things to happen. I’ve posted on Stack Overflow and a very kind person helped with another issue I was having, but I can’t quite get this final thing to work.
If anyone could lend some insight, it would be much appreciated. You can download the project below (treat game.exe like a zip file to extract source) and give it a try or sift through the code if you need to.