LuaJIT compatibility

There were a few problems using CivUp with LuaJIT, primarily pointed out by [DonQuiche](http://forums.civfanatics.com/showthread.php?p=12379531), so I had a go at fixing them.

Only tested a marathon duel map for a few hundred turns, got no errors in lua.log during that time but then maybe I just broke logging completely! Everything appears to work in-game at least, and with much better performance than without LuaJIT.

PS, I am Will13 from the forum.