add -lm for hostlua to fix builds in toolchains that don't have it by default
Fix hostlua build on 64bit Linux when using Hacki's toolchain.
Minor cleanup of module code.