Advertisement
minimite

paintr

Sep 21st, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local colors = "1234567890abcdef"
  2.  
  3. local tArgs = {...}
  4. if #tArgs ~= 2 then
  5. print("Usage: "..shell.getRunningProgram().." <path> <characters>")
  6. return
  7. end
  8.  
  9. local file = tArgs[1]
  10. local loop = tonumber(tArgs[2])
  11.  
  12. if not fs.exists(file) then
  13. local open = fs.open(file, "w")
  14. open.close()
  15. end
  16.  
  17. for i = 1, loop do
  18. local stat = math.random(1,16)
  19. local open = fs.open(file, "a")
  20. local rand = math.random(1,#colors)
  21. local char = colors:sub(rand, rand)
  22. if stat == 5 then
  23. open.writeLine(char)
  24. open.close()
  25. else
  26. open.write(char)
  27. open.close()
  28. end
  29.  
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement