Advertisement
TwiXon4ik

Untitled

Oct 5th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. local c = require("component")
  2. local unicode = require("unicode")
  3. local holo = c.hologram
  4.  
  5. if not holo then error("This program reqiures holoram projector.") end
  6.  
  7.  
  8. local hologram = {}
  9.  
  10. ---------------------------------------
  11.  
  12. local symbols = {
  13. empty = {
  14. {0, 1, 1, 1, 1},
  15. {0, 0, 0, 0, 0},
  16. {0, 0, 0, 0, 0},
  17. {0, 0, 0, 0, 0},
  18. {0, 0, 0, 0, 0},
  19. {0, 0, 0, 0, 0},
  20. {0, 0, 0, 0, 0},
  21. },
  22. }
  23.  
  24. local function clear()
  25. holo.clear()
  26. end
  27.  
  28. function hologram.drawSymbol(x, y, z, symbol, color)
  29. for j = 1, #symbol do
  30. for i = 1, #symbol[j] do
  31. if symbol[j][i] == 1 then
  32. holo.set(x + i - 1, y - j + 1, z, color)
  33. end
  34. end
  35. end
  36. end
  37.  
  38. function hologram.text(x, y, z, text, color)
  39. local length = unicode.len(text)
  40. local smeshenie = 0
  41. for i = 1, length do
  42. local sym = unicode.sub(text, i, i)
  43. hologram.drawSymbol(x + smeshenie, y, z, symbols[sym], color)
  44. smeshenie = smeshenie + 6
  45. end
  46. end
  47.  
  48.  
  49. ---------------------------------------
  50.  
  51. local args = {...}
  52. local scale = tonumber(args[1]) or 1
  53. local height = tonumber(args[2]) or 10
  54.  
  55. local date
  56.  
  57. holo.setScale(scale)
  58.  
  59. while true do
  60. holo.clear()
  61. date = os.date("%T")
  62. hologram.text(1, height, 24, date, 2)
  63. os.sleep(1)
  64. end
  65.  
  66. ---------------------------------------
  67.  
  68. return hologram
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement