Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- phrase = "lol so I want to make a algorithm that finds seperate words and puts them in a table which it seems simple enough to do"
- local tab = {}
- local lastnum = 0
- for i=1,#phrase do
- if string.sub(phrase,i,i) == " " then
- table.insert(tab,string.sub(phrase,lastnum,i-1))
- lastnum = i+1
- end
- end
- table.insert(tab,string.sub(phrase,lastnum,#phrase))
- for i=1,#tab do
- print(i,tab[i])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement