modulemanager: Inside plugins, have global _M as a reference to the module's environment

Sat, 13 Nov 2010 04:09:14 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 13 Nov 2010 04:09:14 +0000
changeset 3620
bfc47564aaef
parent 3619
291ae816d800
child 3621
7e1a1dd42088
child 3623
6f4db418a9cc

modulemanager: Inside plugins, have global _M as a reference to the module's environment

core/modulemanager.lua file | annotate | diff | comparison | revisions
--- 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];

mercurial