Guest User

mcImage.lua

a guest
Jul 7th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. arg = {...}
  2. assert(#arg == 2, 'usage: imageDisplay <image name> <advanced monitor side>')
  3.  
  4. local mon = peripheral.wrap(arg[2])
  5. local image = fs.open('mcPaintFolder/images/'..arg[1], 'r')
  6. local imageString = image.readAll()
  7. local imageTable = textutils.unserialise(imageString)
  8.  
  9. for i = 1, #imageTable do
  10.     for k = 1, #imageTable[i] do
  11.         mon.setCursorPos(i,k)
  12.         mon.setBackgroundColor(imageTable[i][k])
  13.         mon.write(' ')
  14.     end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment