proccesses are working now!
This commit is contained in:
@@ -7,11 +7,15 @@ modpol.orgs.request_params = {
|
||||
|
||||
-- ================================
|
||||
-- creates a new process linked to a request id
|
||||
function modpol.orgs:create_process(request_id)
|
||||
local new_process = {
|
||||
object = "I am a process",
|
||||
request_id = request_id
|
||||
}
|
||||
function modpol.orgs:create_process(process_type, request_id)
|
||||
if not modpol.modules[process_type] then
|
||||
modpol.ocutil.log('Process type "' .. process_type .. '" does not exist')
|
||||
return
|
||||
end
|
||||
|
||||
-- retrieving requested module
|
||||
local module = modpol.modules[process_type]
|
||||
local new_process = module:new_process(request_id, self.id)
|
||||
|
||||
-- linear search for empty process slots (lazy deletion)
|
||||
for k, v in ipairs(self.processes) do
|
||||
@@ -24,8 +28,10 @@ function modpol.orgs:create_process(request_id)
|
||||
-- attempts to fill empty spots in list, otherwise appends to end
|
||||
if empty_index then
|
||||
self.processes[empty_index] = new_process
|
||||
return empty_index
|
||||
else
|
||||
table.insert(self.processes, new_process)
|
||||
return #self.processes
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user