lua-users home
lua-l archive

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

I have been trying to use COPAS to do asynchronous HTTP requests. I keep
getting the "attempt to yield across metamethod/C-call boundary" error
even after I converted my pcalls to calls etc.

function	DoAsyncRequest(request)
	local	t = {};
	local	wrapper = copas.wrap;
	local	tcpsocket = socket.tcp;

	local	requestTable = {
	        url = request,
        	sink = ltn12.sink.table(t),
        	create = copas.cosocket.tcp

	local code, headers, status = socket.skip(1,

    return table.concat(t), code, headers, status;

myUrl = "";;

function TestURL()
	print("Trying to get URL");


I didn't have any problems with coroutines when I implemented a simple
scheduler/coroutine thread system.

Since COPAS is a part of Kepler/Xavante, I assume it must be working for

All I really need is a way to do (mostly) non-blocking HTTP, so I may end
up abandoning COPAS and socket.http and implementing something simpler
using socket.tcp with zero timeouts.

For a language as beautifully designed as Lua, the limitations on
coroutines seem very vague and constricting.

 Juri Munkki