Advertisement
Fanatiks

Holo.lua

Aug 22nd, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 KB | None | 0 0
  1. local component=require("component")
  2. local unicode=require("unicode")
  3. local term=require("term")
  4. term.clear()
  5. local gpu=component.gpu
  6. local holo=component.hologram
  7. holo.setScale(2)
  8. holo.clear()
  9. local function bpack(bits)
  10. local o=0
  11. for k,v in pairs(bits) do
  12. o=o+((2^(k-1))*v)
  13. end
  14. return o
  15. end
  16. local function bunpack(num)
  17. local o={}
  18. for l1=1,32 do
  19. o[l1]=math.floor(num/2^(l1-1))%2
  20. end
  21. return o
  22. end
  23. local txt={
  24. A={" ### ","# #","#####","# #","# #"},
  25. B={"#### ","# #","#### ","# #","#### "},
  26. C={" ####","# ","# ","# "," ####"},
  27. D={"#### ","# #","# #","# #","#### "},
  28. E={"#####","# ","#####","# ","#####"},
  29. F={"#####","# ","#####","# ","# "},
  30. G={" ####","# ","# ###","# #"," ####"},
  31. H={"# #","# #","#####","# #","# #"},
  32. I={"#####"," # "," # "," # ","#####"},
  33. J={" ####"," #"," #","# #"," ### "},
  34. K={"# #","# # ","### ","# # ","# #"},
  35. L={"# ","# ","# ","# ","#####"},
  36. M={" # # ","# # #","# # #","# #","# #"},
  37. N={"# #","## #","# # #","# ##","# #"},
  38. O={" ### ","# #","# #","# #"," ### "},
  39. P={"#### ","# #","#### ","# ","# "},
  40. Q={" ### ","# #","# # #","# #"," ####"},
  41. R={"#### ","# #","#### ","# #","# #"},
  42. S={" ####","# "," ### "," #","#### "},
  43. T={"#####"," # "," # "," # "," # "},
  44. U={"# #","# #","# #","# #"," ### "},
  45. V={"# #","# #","# #"," # # "," # "},
  46. W={"# #","# #","# # #","# # #"," # # "},
  47. X={"# #"," # # "," # "," # # ","# #"},
  48. Y={"# #","# #"," # # "," # "," # "},
  49. Z={"#####"," # "," # "," # ","#####"},
  50. [" "]={" "," "," "," "," "},
  51. ["<"]={" # "," # "," # "," # "," # "},
  52. ["3"]={"#### "," #"," ### "," #","#### "},
  53. }
  54. local dat={}
  55. local zd={}
  56. for z=1,32 do
  57. zd[z]=0
  58. end
  59. local fq={}
  60. for x=1,48 do
  61. dat[x]={}
  62. fq[x]={}
  63. for y=1,48 do
  64. dat[x][y]={table.unpack(zd)}
  65. fq[x][y]=false
  66. end
  67. end
  68. local function set(x,y,z,st)
  69. fq[x][y]=true
  70. dat[x][y][z]=st and 1 or 0
  71. end
  72. local function fl()
  73. for x=1,48 do
  74. for y=1,48 do
  75. if fq[x][y] then
  76. holo.set(x,y,bpack(dat[x][y]))
  77. fq[x][y]=nil
  78. end
  79. end
  80. end
  81. end
  82. local b=0
  83. for char in ("<3 KODOS"):gmatch(".") do
  84. for l1=1,5 do
  85. for l2=1,5 do
  86. if txt[char][l1]:sub(l2,l2)~=" " then
  87. set(24,(l2)+b,(6-l1)+10,true)
  88. gpu.set(l2+b,l1,unicode.char(0x2588))
  89. end
  90. end
  91. end
  92. b=b+6
  93. end
  94. fl()
  95. term.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement