function splitLines(str)
local delim = "\r?\n"
local result,pat,lastPos = {},"(.-)" .. delim .. "()",1
for part, pos in string.gmatch(str, pat) do
table.insert(result, part); lastPos = pos
end
table.insert(result, string.sub(str, lastPos))
return result
endreplaced gfind (Lua 5.0) with gmatch (Lua 5.1+)
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment