a.lua
b.lua
both do
while (true) do os.sleep(0) end
Now, let's say we had a third that could be used too stop any one of those a, or b programs started.
How could I stop the co routine created by the parallel API without it successfully returning.
Posted 11 December 2014 - 12:29 AM
while (true) do os.sleep(0) end
Posted 11 December 2014 - 01:17 AM
Posted 11 December 2014 - 02:06 AM
Posted 11 December 2014 - 10:26 AM
Edited by ElvishJerricco, 11 December 2014 - 10:28 AM.
Posted 11 December 2014 - 01:15 PM
local routinesToKill = {}
local installed
function kill(routine)
routinesToKill[routine] = true
if not installed then
local oldStatus = coroutine.status
coroutine.status = function(routine)
return routinesToKill[routine] and "dead" or oldStatus(routine)
end
installed = true
end
endThat should work, though I just wrote it. Completely untested.
Edited by AgentE382, 11 December 2014 - 01:16 PM.
Posted 11 December 2014 - 09:44 PM
AgentE382, on 11 December 2014 - 01:15 PM, said:
local routinesToKill = {}
local installed
function kill(routine)
routinesToKill[routine] = true
if not installed then
local oldStatus = coroutine.status
coroutine.status = function(routine)
return routinesToKill[routine] and "dead" or oldStatus(routine)
end
installed = true
end
endThat should work, though I just wrote it. Completely untested.Posted 12 December 2014 - 02:32 AM
ElvishJerricco, on 11 December 2014 - 09:44 PM, said:
AgentE382, on 11 December 2014 - 01:15 PM, said:
local routinesToKill = {}
local installed
function kill(routine)
routinesToKill[routine] = true
if not installed then
local oldStatus = coroutine.status
coroutine.status = function(routine)
return routinesToKill[routine] and "dead" or oldStatus(routine)
end
installed = true
end
endThat should work, though I just wrote it. Completely untested.Edited by AgentE382, 12 December 2014 - 02:42 AM.
0 members, 3 guests, 0 anonymous users