Implement a lua scripting api

**NOTE: This is NOT yet ready to merge,** I'm just creating a PR to get feedback!

Basically, it's an attempt at a scripting API. Should help other people get involved more easily, as well as creating more advanced things that are easier to express in a higher-level language (NPCs maybe?).

Most of the code in this PR is libraries being added, specifically Lua and (SGLib)[http://sglib.sourceforge.net] to provide linked lists and other general data structures. I've not done much proper C development, so I don't know what's 'standard' for that sort of thing, but SGLib got me out of trouble.

I've also not tested the Windows code at all, so that's probably broken.

But I think it could be useful eventually!