Advertisement
montana_1

Get Total Inventory of Turtle

Oct 13th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. function getInv() --Returns total inventory of the turtle
  2.         local c = 1
  3.     local total = 0
  4.         while( c < 17) do
  5.         total = total + turtle.getItemCount(c)
  6.                 c = c + 1
  7.         end
  8.     return total
  9. end
  10.  
  11. mon = peripheral.wrap("left")
  12. mon.clear()
  13.  
  14. while(1) do
  15.     mon.setCursorPos(1,1)
  16.     mon.write(getInv())
  17.     sleep(1)
  18.     mon.clear()
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement