Last active
June 21, 2018 09:15
-
-
Save THE-FYP/4d245742ea05980d5e767a8ccb6e9f00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function split(str, delim, plain) | |
local lines, pos, plain = {}, 1, not (plain == false) --[[ delimiter is plain text by default ]] | |
repeat | |
local npos, epos = string.find(str, delim, pos, plain) | |
table.insert(lines, string.sub(str, pos, npos and npos - 1)) | |
pos = epos and epos + 1 | |
until not pos | |
return lines | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment