sibomots

Untitled

Jun 30th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. -- LoadImage
  2. -- NuAoA
  3. local targ={...}
  4. os.loadAPI("wrap")
  5. mon = wrap.attach("monitor")
  6. mon.setTextScale(0.5)
  7. mon.clear()
  8. mon.setCursorPos(1,1)
  9. if #targ==0 then
  10. print("Type the filename of the image you would like to load:")
  11. local filename = io.read()
  12. else
  13. filename = targ[1]
  14. end
  15. local file = io.open(filename,"r")
  16. local i =1
  17. local j =0
  18. local conv = {}
  19. for line in file:lines() do
  20. for word in string.gmatch(line,"%d+") do
  21. if j == 0 and i<= 16 then
  22. conv[word] = i-1
  23. else
  24. mon.setCursorPos(i,j)
  25. mon.setBackgroundColor(2^conv[word])
  26. mon.write(" ")
  27. end
  28. i=i+1
  29. end
  30. i=1
  31. j=j+1
  32. end
  33. file:close()
Add Comment
Please, Sign In to add comment