Advertisement
BlueMond

glassSearch

Jan 29th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local storage = peripheral.wrap("right")
  2. local glass = peripheral.wrap("left")
  3.  
  4.  
  5. write("Search: ")
  6. local search = read()
  7.  
  8. local fing
  9. local count
  10. local id
  11.  
  12. function find()
  13.     local all = storage.getAvailableItems()
  14.  
  15.     for num, item in pairs(all) do
  16.         fing = item.fingerprint
  17.         count = item.size
  18.         id = fing.id
  19.    
  20.         if string.find(id, search) then
  21.             print(id..": "..count)
  22.             return
  23.         end
  24.     end
  25. end
  26.  
  27. glass.clear()
  28. glass.sync()
  29.  
  30. while true do
  31.     sleep()
  32.     find()
  33.     glass.clear()
  34.     glass.addText(1,10,id..": "..count,0xFFFFFF)
  35.     glass.sync()
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement