Remove unused function moon.loader, add some missing local declarations, add Terra support

To run terra tests (*.t files) you need to specify the lua interpreter as terra on the command line, or modify the busted shell script. By default terra runs with strict mode on, so there will be errors about declaring global variables inside functions in 3rd-party libraries. I resolved this by patching those libraries directly to add the missing local keyword (since that's bad code anyway, and easy to re-do when updating the libraries.) It can also be resolved by disabling strict mode.

    Strict.__newindex,Strict.__index = nil,nil