Update process.lua
This commit is contained in:
@@ -7,9 +7,17 @@ function process:new(path, window, ...)
|
|||||||
local newP = setmetatable({ path = path }, { __index = self })
|
local newP = setmetatable({ path = path }, { __index = self })
|
||||||
newP.window = window
|
newP.window = window
|
||||||
newP.processId = processId
|
newP.processId = processId
|
||||||
|
if(type(path)=="string")then
|
||||||
newP.coroutine = coroutine.create(function()
|
newP.coroutine = coroutine.create(function()
|
||||||
shell.execute(path, table.unpack(args))
|
shell.execute(path, table.unpack(args))
|
||||||
end)
|
end)
|
||||||
|
elseif(type(path)=="function")then
|
||||||
|
newP.coroutine = coroutine.create(function()
|
||||||
|
path(table.unpack(args))
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
processes[processId] = newP
|
processes[processId] = newP
|
||||||
processId = processId + 1
|
processId = processId + 1
|
||||||
return newP
|
return newP
|
||||||
@@ -22,7 +30,6 @@ function process:resume(event, ...)
|
|||||||
self.filter=nil
|
self.filter=nil
|
||||||
end
|
end
|
||||||
local ok, result = coroutine.resume(self.coroutine, event, ...)
|
local ok, result = coroutine.resume(self.coroutine, event, ...)
|
||||||
self.window = term.current()
|
|
||||||
if ok then
|
if ok then
|
||||||
self.filter = result
|
self.filter = result
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user