|
@@ -1,6 +1,6 @@
|
|
|
function modpol.orgs:call_module(module_name, initiator, config, result)
|
|
|
if not modpol.modules[module_name] then
|
|
|
- modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. name .. '" not found')
|
|
|
+ modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_name .. '" not found')
|
|
|
return
|
|
|
end
|
|
|
|
|
@@ -23,12 +23,22 @@ function modpol.orgs:call_module(module_name, initiator, config, result)
|
|
|
|
|
|
local module = modpol.modules[module_name]
|
|
|
|
|
|
+ -- sets default values for undeclared config variables
|
|
|
+ if module.config then
|
|
|
+ for k, v in pairs(module.config) do
|
|
|
+ if config[k] == nil then
|
|
|
+ config[k] = v
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
-- setting default params
|
|
|
local new_process = {
|
|
|
metatable = {__index = module},
|
|
|
initiator = initiator,
|
|
|
org = self,
|
|
|
- id = index
|
|
|
+ id = index,
|
|
|
+ config = config
|
|
|
}
|
|
|
|
|
|
-- copying default fields from setup
|
|
@@ -39,15 +49,7 @@ function modpol.orgs:call_module(module_name, initiator, config, result)
|
|
|
setmetatable(new_process, new_process.metatable)
|
|
|
|
|
|
self.processes[index] = new_process
|
|
|
-
|
|
|
- -- sets default values for undeclared config variables
|
|
|
- for k, v in pairs(module.config) do
|
|
|
- if config[k] == nil then
|
|
|
- config[k] = v
|
|
|
- end
|
|
|
- end
|
|
|
-
|
|
|
- self.processes[index]:initiate(config, result))
|
|
|
+ self.processes[index]:initiate(result)
|
|
|
|
|
|
return index
|
|
|
end
|