Advertisement
NanoBob

index chests

Aug 21st, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. chestOne=peripheral.wrap("left")
  2. chestTwo=peripheral.wrap("right")
  3.  
  4. function getItems()
  5.   items={}
  6.   allItems=chestOne.getAllStacks()
  7.   for nothing,itemData in pairs(allItems) do
  8.     items[itemData['id']]={itemData['name'],itemData['qty']}
  9.   end
  10.   allItems=chestTwo.getAllStacks()
  11.   for nothing,itemData in pairs(allItems) do
  12.     if items[itemData['id']]==nil then
  13.        items[itemData['id']]={itemData['name'],itemData['qty']+items[itemData['id']]['qty']}
  14.     else
  15.        items[itemData['id']]={itemData['name'],itemData['qty']}
  16.     end
  17.   end
  18.   for id,data in pairs(items) do
  19.     print(id.." ("..data['name']..") : "..data['count'])
  20.   end
  21. end
  22.  
  23. function getSpecificItemCount(id)
  24.  
  25. end
  26.  
  27. function pullItem(id,count)
  28.  
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement