Implement a template-based classical Perlin noise generator.

The mask argument of the Impl template is there because apparently
an inner template cannot be fully specialized, so there needs to be
some argument besides i.
Fix the lua script not printing any errors if executing a file fails.