masterdisasterHD

Seperator

Jul 28th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.18 KB | None | 0 0
  1. function seperate(str, sep)
  2.  local sep, fields = sep or " ", {}
  3.  local pattern = string.format("([^%s]+)", sep)
  4.  str:gsub(pattern, function(c) fields[#fields+1] = c end)
  5.  return fields
  6. end
Add Comment
Please, Sign In to add comment