> > local n=0 > > for i in s:gmatch("\n") do n=n+1 end > > print(n) > > Thanks, I'll use that one then :-) BTW, I didn't say it was the fastest way, but the idea here is that most of the scanning is done on the C side. YMMV...