lua-users home
lua-l archive

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


It was thus said that the Great Roberto Ierusalimschy once stated:
> >   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?

  1) Why have LUA_BUFFERSIZE when BUFSIZ exists?

  2) I still need to use C to know what the value is.  It seems like
overkill, and Lua already wraps several standard C functions, so why not a
constant?

  -spc