Detect lua5.2 and improve the script
Merge pull request #1693 from cmouse/lua-5.2-support

Detect lua5.2 and improve the script