Advertisement
SirBaconBitz

IMG API

Mar 27th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. bridge = peripheral.wrap("right")
  2. function loadimg(startx, starty )
  3.                 local img = io.open("hat", "r")
  4.                 x = startx
  5.                 y = starty
  6.         origx = startx
  7.                 while true do
  8.             local line = img:read()
  9.             if line == nil then
  10.             break
  11.             end
  12.                         for color in line:gmatch('%S+') do
  13.                                 if color:len() == 3 then
  14.                                         newcol = color..color
  15.                                 else
  16.                                         newcol = color
  17.                                 end
  18.                                 col = tonumber(tostring(newcol),16)
  19.                                 bridge.addBox(x,y,1,1,col,1)
  20.                                 x = x + 1
  21.                 print("Added "..tostring(newcol).." as "..tostring(col))
  22.                         end
  23.                         sleep(0.001)
  24.                         print("ended for")
  25.                         y = y + 1
  26.             x = origx
  27.                 end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement