Advertisement
NanoBob

utils

Feb 28th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. function split(sourceString,splittingChar,index)
  2.     results={}
  3.     currentWord=""
  4.     for i=1,string.len(sourceString) do
  5.         letter=string.sub(sourceString,i,i)
  6.         if letter==splittingChar then
  7.             results[#results+1]=currentWord
  8.             currentWord=""
  9.         else
  10.             currentWord=currentWord..letter
  11.         end
  12.     end
  13.     results[#results+1]=currentWord
  14.     return results[index], results
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement