Advertisement
johnnic431

Req Pipe API

Jun 24th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. --[[Logistic Pipe request API
  2.  
  3. Sylvyrfysh - All Rights Reserved
  4. Unauthorized copying, and/or redistribution of this file, via any medium without express written permission of Sylvyrfysh (Nicholas Johnson) is strictly prohibited
  5. Proprietary and confidential
  6. Written by Nicholas Johnson <johnnic431@gmail.com>, June 24 2015
  7.  
  8. ]]
  9.  
  10. local p=peripheral.wrap("bottom")
  11.  
  12. function getItemsListRaw()
  13.     return p.getAvailableItems();
  14. end
  15.  
  16. function getItemsList(rawItems)
  17.     if rawItems==nil then return false; end
  18.     _tItems={}
  19.     for t,y in pairs(rawItems) do
  20.         _tItems[#_tItems+1]=y.getValue1();
  21.     end
  22.     return _tItems
  23. end
  24.  
  25. function makeItemsList(plainList)
  26.     _tList={}
  27.     for t,y in pairs(plainList) do
  28.         _tItem={}
  29.         _tItem={["itemID"]=y.getId()..":"..y.getData(),["itemName"]=y.getName(),["amount"]=p.getItemAmount(y),["itemReference"]=y}
  30.         _tList[#_tList+1]=_tItem
  31.     end
  32.     return _tList
  33. end
  34.  
  35. function getItem(item,quantity)
  36.     p.makeRequest(item,quantity)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement