It was thus said that the Great Thiago L. once stated:
-- mt = "main thread"
-- co = a coroutine
-- t[1] = pcall status
-- t[2] = coroutine.resume status (or error if t[1] is false)
-- etc
local mt = coroutine.running()
local co = coroutine.create(stuff)
debug.sethook(co, function(...)
if debug.gethook(mt) then
return debug.gethook(mt)()
end
end)
local t = table.pack(pcall(coroutine.resume,co))
if t[1] and t[2] then
return select(3,table.unpack(t))
elseif t[1] and not t[2] then
return t[2], t[3]
elseif not t[1] then
return t[1], t[2]
end
What are you trying to do here? When I run this code, all it does it sit
there, producing vast amounts of nothing.
-spc