Lua 5.1 compatibility

Some implementation changes and inclusion of compat-5.2 so library may
be compiled and run under Lua 5.1 in addition to 5.2. Added rockspec.