Implement lua scripting support

Not ready for merge yet.

TODO:
- Get the lua makefile dependency stuff to work on all systems.