Text line breaks

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, "|", "\

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
    -- need a line break

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.