[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [NoW] Missing things from Lua
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 16 May 2019 15:08:06 -0300
> So I have this event driven network driver [1] where I can use Lua
> coroutines to handle a TCP [2] or TLS [3] connections (both client and
> server). I also have code that turns such a connection into an object that
> looks like a Lua file object [4] so that I can do things like:
>
> line = conn:read("l")
> raw = conn:read(128)
> linecrlf = conn:read("L")
>
> I can't just wrap these up in a FILE* because that abstraction doesn't
> lend itself to event driven programming. If I could, I would have, but it
> doesn't work, so I had to write this code.
>
> As it stands right now, it does *NO* buffering [5]. It would be nice to
> support buffering [6] but it's hard to know what the default amount to
> buffer is, hence the request for io.BUFFERSIZE. Right now, all the code is
> in pure Lua, I would hate to have to drop to C for just one constant.
I still fail to wee why you need LUA_BUFFERSIZE. Why not BUFSIZ?
-- Roberto