# HG changeset patch # User Matthew Wild # Date 1289621354 0 # Node ID bfc47564aaef8afc94d725d6b0be426d59112f26 # Parent 291ae816d8004e89b448ed667a96b6e203d87b5e modulemanager: Inside plugins, have global _M as a reference to the module's environment diff -r 291ae816d800 -r bfc47564aaef core/modulemanager.lua --- a/core/modulemanager.lua Sat Nov 13 03:16:58 2010 +0000 +++ b/core/modulemanager.lua Sat Nov 13 04:09:14 2010 +0000 @@ -117,6 +117,7 @@ local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); api_instance.environment = pluginenv; + pluginenv._M = pluginenv; setfenv(mod, pluginenv); hosts[host].modules = modulemap[host];