Lua-Support: Improved automatic configuration.

- Improved the way the plug-in directory is obtained in case of a global
  installation.
- Added templates for metamethods.