@Hawhill
If you have a need to make Lua-5.1, "C" extension code work under Lua-5.2 . . . .
I have written a bit of version glue code (luaL_register for 5.2) that should ease the chore.
See:
http://hg.minimodding.com/repos/lua/lusb.hg/summary
Repo also contains the PIL(5.1) Chapter 28 examples as test cases under Lua-5.2