Fix Lua interpreter name and install path

Allow more generic uses of the Makefile
Add interpreter name to the script
Better compatibility between Lua 5.1 and Lua 5.2

Remove functions deprecated in Lua 5.2 and provide workarounds for
Lua 5.1. Make compatibility more natural.