lua-users home
lua-l archive

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


Hi,

I sort of understand the C-call limitation but is not
quite sure about the metamethod one.

I am trying to work on making the socket.http(in
luasocket) module becomes async(COPAS) capable and
encounter this error.

And I am pretty sure there is no C-call involved in
the yield chain but there is some metamethod involve.

Kind of in the following chain :

function http:sendheader()
  header = 'whatever header'
  self.sock:send(header)
end

function co1()
  http:send()
end

function co2()
  sock:send()
end

resume(co1) -- error
resume(co2) -- doing fine

here http is an object which handles the HTTP protocol
and store the underlying socket object(where the
send/receive is COPAS wrapped)

I can work around this using luajit or COCO patch but
just wondering why introducing one level of
indirection like the above breaks the whole coroutine
thing.



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ