Added support for Lua 5.2 (via an env wrapper), minor other changes.