Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Text line breaks

edited September 2012 in Questions Posts: 58

How can I take a normal Line of text, and put a line break after specific characters?



  • How about:

    s = "Line 1|Line 2"
    s = string.gsub(s, "|", "\n")
  • The best chance I see is to do it manually with string.sub():

    line80 = string.sub(line, 1, 80) morelines = string,sub(line, 81) if morelines == "" then -- no line break needed else -- need a line break end

    You may need to run it in a loop for very long strings, of course. The code above is just to get the idea.

  • After reading mpilgrem's code, I probably misunderstood the question.

Sign In or Register to comment.