lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 15/08/14 06:51 PM, Sean Conner wrote:
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


A SIGINT should kill it... if not, read my other post...