Advertisement
BobMe

string splitter

Aug 28th, 2020
1,385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.32 KB | None | 0 0
  1. -- basically string.split from roblox
  2. function split(str,splitter)
  3.   local tab = {}
  4.   local lastnum = 1
  5.   for i=1,#str do
  6.     if string.sub(str,i,i) == splitter then
  7.       table.insert(tab,string.sub(str,lastnum,i-1))
  8.       lastnum = i+1
  9.     end
  10.   end
  11.   table.insert(tab,string.sub(str,lastnum))
  12.   return tab
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement