[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to count the number of lines in a string?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 31 Jul 2008 10:00:21 -0300
> You can make it so just an empty string is pushed if there is at least
> one newline:
>
> local n = select(2, s:gsub("[^\n]*\n[^\n]*", ""))
Or this:
local _,n = s:gsub('.-\n', '')