Advertisement
Guest User

Untitled

a guest
Apr 25th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local gpu = require("component").gpu
  2.  
  3. local gpu_set,gpu_BGC = gpu.set,gpu.setBackground
  4. function char_color(input,color,x,y)
  5.     for group in input:gmatch("[^\n]+") do
  6.         for char in group:gmatch(".") do
  7.             if color[char] then
  8.                 gpu_BGC(color[char])
  9.                 gpu.set(x,y," ")
  10.             end
  11.             x = x + 1
  12.         end
  13.         y = y + 1
  14.     end
  15. end
  16.  
  17. local pattern = [[
  18. 0011001100
  19. 1111111111
  20. 0011111100
  21. 0000110000
  22. ]]
  23.  
  24. char_color(pattern,{["1"] = 0xFF0000},1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement