Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function separate(str)
- local tbl={}
- local pos=str:find'%S'
- while pos do
- if str:sub(pos,pos)=="\"" then
- local closingQuote=str:find("\"",pos+1)
- if closingQuote then
- tbl[#tbl+1]=str:sub(pos+1,closingQuote-1)
- pos=closingQuote+1
- else
- pos=pos+1
- print("No matching quote")
- end
- else
- tbl[#tbl+1],pos=str:match("([^%s\"]+)()",pos)
- end
- pos=str:find("%S",pos)
- end
- return tbl
- end
- print("{\""..table.concat(separate[[ This is a string. "This is also a string." Also, you're ugly. ]],"\",\"").."\"}")
Advertisement
Add Comment
Please, Sign In to add comment