Make our loader work like Lua's built-in loaders

Our loader for lua files distributed with the extension doesn't work
like Lua's built-in loaders. Fix that.

Change-Id: I7576f0e173c10a589f7ebf2c121230ed66b538fe