Fix shadowing by using variables with a different name or _.
I don't think any of these warnings were actual bugs and fixed them to
maintain the same behaviour.
Run luacheck on CI to catch subtle errors.
Add a luacheckrc that ensures current code issues no warnings. We should
eventually try to remove many of these ignores.