lua-users home
lua-l archive

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


> what is the most efficient way of counting the number of lines?

Try this one:

local n=0
for i in s:gmatch("\n") do n=n+1 end
print(n)