[Torch] LuaCheck config file and fixes to make lint clean

We've found the LuaCheck tool (https://github.com/mpeterv/luacheck) to be useful in catching bugs in our code, so this may be a useful addition.

There are two real bugs that this tool has detected (`Euclidean`/`WeightedEuclidean` not respecting the `scale` argument), and the rest are just minor fixes to remove unused variables, which helps make the intent of the code clearer.