lua-users home
lua-l archive

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


On Thu, May 08, 2003 at 09:55:19AM -0300, Roberto Ierusalimschy wrote:

<snip>

> you may have a bad surprise (see http://www.lua.org/notes/ltn009.html).
> (This has nothing to do with the hashing; Java has exactly the same
> problem.) 

I used this technique in my talker server, which receives bits of data
from each client, but only triggers the processing of a line when it
receives a new line character.  It's *much* faster than doing it the
easy way, even for reasonably short strings that you might receive at a
few bytes at a time (such as a short sentence that somebody says.)

Things started getting a little complex when I needed to stoop the
contents of the string stack for telnet codes, but otherwise, I'd
recommend doing this to anybody who needs to process strings of unknown
length.

B.
-- 
Rob Kendrick, Pepperfish Limited                   http://www.pepperfish.net/
PGP signed or encrypted mail welcome                         Key ID: 3651D17A