[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] lpty 0.8-1
- From: Ed <spied@...>
- Date: Tue, 17 Aug 2010 19:47:38 +0400
Gunnar Zötl wrote:
You can get lpty from http://www.tset.de/lpty/ or from the luarocks repository.
I think better is luasocket-alike interface:
1. read() can be renamed to receive()
btw, read/send pair is strange.
2. In luasocket only one receive function return error message too:
If successful, the method returns the received pattern. In case of
error, the method returns *nil* followed by an error message
3. Your version of send() did not understand partial writes, in luasocket:
client:*send(*data [, i [, j]]*)*
Sends data through client object.
Data is the string to be sent. The optional arguments i and j work
exactly like the standard string.sub Lua function to allow the selection
of a substring to be sent.
If successful, the method returns the index of the last byte within [i,
j] that has been sent. Notice that, if i is 1 or absent, this is
effectively the total number of bytes sent. In case of error, the method
returns *nil*, followed by an error message, followed by the index of
the last byte within [i, j] that has been sent.
4. You define sendok() and readok(), but sometimes better is check
several file descriptors in one select/poll call.
luasocket provide getfd() function for this.