From 5a2e6277e5177547b655e3aadc99b48f572fef22 Mon Sep 17 00:00:00 2001 From: Luke Miller Date: Wed, 29 Dec 2021 21:10:00 -0500 Subject: [PATCH] added a module version of call_module which automatically handles parent ids in the backend --- modpol_core/orgs/process.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modpol_core/orgs/process.lua b/modpol_core/orgs/process.lua index 9ebb03b..5f9d170 100644 --- a/modpol_core/orgs/process.lua +++ b/modpol_core/orgs/process.lua @@ -1,6 +1,6 @@ --- Process functions for orgs -function modpol.orgs:call_module(module_slug, initiator, config, result) +function modpol.orgs:call_module(module_slug, initiator, config, result, parent_id) if not modpol.modules[module_slug] then modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found') return @@ -34,18 +34,23 @@ function modpol.orgs:call_module(module_slug, initiator, config, result) end end - -- setting default params local new_process = { metatable = {__index = module}, initiator = initiator, org = self, id = index, + parent_id = parent_id, config = config, data = module.data, slug = module_slug } + -- call module wrapper for modules, passes its id to child process when called + function new_process:call_module(module_slug, initiator, config, result) + self.org:call_module(module_slug, initiator, config, result, self.id) + end + setmetatable(new_process, new_process.metatable) self.processes[index] = new_process