aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/moduleapi.lua2
-rw-r--r--core/modulemanager.lua1
2 files changed, 3 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index a577c07a..7a3bd1c8 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -135,6 +135,7 @@ end
-- Intentionally does not allow the table at a path to be _set_, it
-- is auto-created if it does not exist.
function api:shared(...)
+ if not self.shared_data then self.shared_data = {}; end
local paths = { n = select("#", ...), ... };
local data_array = {};
local default_path_components = { self.host, self.name };
@@ -150,6 +151,7 @@ function api:shared(...)
shared_data[path] = shared;
end
t_insert(data_array, shared);
+ self.shared_data[path] = shared;
end
return unpack(data_array);
end
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index f263816b..aca314c0 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -144,6 +144,7 @@ local function do_load_module(host, module_name)
local ok, result, module_err = call_module_method(mod, "add_host", host_module_api);
if not ok or result == false then return nil, ok and module_err or result; end
local host_module = setmetatable({ module = host_module_api }, { __index = mod });
+ host_module.module.environment = host_module;
modulemap[host][module_name] = host_module;
return host_module;
end