Advertisement
Guest User

Stock.lua

a guest
Nov 9th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. local keeplistAPI = dofile("/Stockprg/keeplistAPI.lua")
  2. local comp   = require("component")
  3. local sides  = require("sides")
  4. local colors = require("colors")
  5. local rs     = comp.redstone
  6.  
  7.  
  8. local bunSide = sides.left -- side where bundled cabel is connected
  9. -- //local ae = comp.get("2904f916-5266-443d-b392-41eae14f30c")
  10. local ae = comp.me_interface
  11. function findUpdated(keepItem)
  12.   local newlist = ae.getAvailableItems()
  13.  
  14.   for number,item in pairs(newlist) do
  15.     if    keepItem["id"] == item.fingerprint.id
  16.       and keepItem["dmg"]== item.fingerprint.dmg
  17.       and keepItem["nbt_hash"] == item.fingerprint.nbt_hash  
  18.       then lvlStock(keepItem["keepqty"], item.size, keepItem["color"])
  19.     end  
  20.   end
  21. end
  22.  
  23. function lvlStock( kItemQty , aeItemQty , barva)
  24.  
  25.     if kItemQty <= aeItemQty   then rs.setBundledOutput(bunSide,barva,0)
  26.                                     print("True")
  27.                                else rs.setBundledOutput(bunSide,barva,255)
  28.                                     print("False")  
  29.      end
  30. end    
  31.  
  32. rs.setBundledOutput(bunSide,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0})
  33.    
  34. while true do
  35.  for i=1,#keeplistAPI do
  36.    findUpdated(keeplistAPI[i])
  37.  
  38.  end
  39. os.sleep(5)
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement