lua-users home
lua-l archive

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


Here's one way:

function loopLines(str)
  local x, a, b = 1;
  while x < string.len(str) do
    a, b = string.find(str, '.-\n', x);
    if not a then
      break;
    else
        --Do stuff (you can use string.sub with the indicies a and b)
    end;
    x = b + 1;
  end;
end;

-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing to do and always a clever thing to say."

-Will Durant