Lua Line Wrapping excluding certain characters
问题 I've located a code that I want to use when I'm writing notes on a MUD I play. Lines can only be 79 characters long for each note, so it's a hassle sometimes to write a note unless you're counting characters. The code is below: function wrap(str, limit, indent, indent1) indent = indent or "" indent1 = indent1 or indent limit = limit or 79 local here = 1-#indent1 return indent1..str:gsub("(%s+)()(%S+)()", function(sp, st, word, fi) if fi-here > limit then here = st - #indent return "\n".