Fixing Luarocks

Closes #32354.

Primarily, this fixes Luarocks. It also adds a shared, simple test to Lua & Lua51, tidies up all formulae involved, and revisions all 4 lua-something formulae. 

Theoretically, this could work without revisioning anything other than Luarocks, but doing it this way is much cleaner, smoother and reduces the risk of a lingering lua screwing this update up for users.
Everything is actually building fine without the patch in place, so I'll kill it off. If the issue comes back, we can look at it again. Perhaps the slightly modified language in the newer version was enough to eliminate the rogue false positives.