Advertisement
BobMe

word scrambler

Jun 19th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. -- word scrambler because im bored in summer school when I should be doing my work
  2.  
  3.  
  4. word = "POTATO"
  5.  
  6. local tab = {}
  7. local tab2 = {}
  8. local word2 = ""
  9.  
  10. for i=1,#word do
  11. table.insert(tab,#tab+1,string.sub(word,i,i))
  12. end
  13.  
  14. function kek(strin)
  15. for i=1,#tab do
  16. if tab[i] == strin then
  17. table.remove(tab,i)
  18. end
  19. end
  20. end
  21.  
  22. while #tab ~= 0 do
  23. local k = math.random(1,#tab)
  24. table.insert(tab2,#tab2+1,tab[k])
  25. table.remove(tab,k)
  26. end
  27.  
  28. for i=1,#tab2 do
  29. word2 = word2..tab2[i]
  30. end
  31.  
  32. print(word2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement