Advertisement
argaman

Untitled

Jun 20th, 2019
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local function rainbowText(text)
  2. -- define the colors we want in the order we want them to appear.
  3. -- in this case, roygbv
  4. local _colors = {
  5. colors.red,
  6. colors.orange,
  7. colors.yellow,
  8. colors.green,
  9. colors.blue,
  10. colors.purple
  11. }
  12.  
  13. -- go through all of the letters of text
  14. for i=1, #text do
  15. local char = text:sub(i,i)
  16. -- set the text color to the first color in our _colors table
  17. term.setTextColor(_colors[1])
  18. -- then write the character
  19. write(char)
  20. -- send the first color of our _colors table to the end
  21. -- we've already used it, so we move on to the next one.
  22. table.insert(_colors, table.remove(_colors, 1))
  23. end
  24. end
  25.  
  26. rainbowText("Welcome to my room, niggas")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement