--processManager.lua
pullEventRaw_Backup = os.pullEventRaw
local function _init_()
if not _PM_RUN_STATUS then
print('loading api')
_PM_RUN_STATUS=1
--define coroutines
co_func = coroutine.create(func)
return
end
end
local function func()
print('func is running')
local received = {}
for i=1,#interface.tInterfaceWrap do
local event = {os.pullEventRaw()}
if event and event[2] == "modem_message" and event[6] then
table.insert(received,event[6])
end
end
return received
end
function _G.os.pullEventRaw(sFilter)
print('os.pullEventRaw is called')
while true do
local event = {pullEventRaw_Backup()}
print('event pulled')
if coroutine.status(co_func) == "suspended" then
print('resuming coroutine')
coroutine.resume(co_func, table.unpack(event))
end
if sFilter == event[1] or not sFilter then
return table.unpack(event)
end
end
end
_init_()
CORRECT ANSWER HERE
Edited by jacky500, 07 March 2016 - 02:28 AM.












