Pandafuchs

Essensautomat

Oct 2nd, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. local mySensor = sensor.wrap("back")
  3. local verbraucht = 0;
  4.  
  5. function getGuthaben()
  6.     local geldChest = mySensor.getTargetDetails("0,-3,1");
  7.     local content = geldChest["Slots"]
  8.     local amount = 0;
  9.     for k, v in pairs( content ) do
  10.         for a, b in pairs(v) do
  11.             if a == "RawName" and b == "ic2.industrial credit" then
  12.                 amount = amount + v["Size"]
  13.             end
  14.         end
  15.     end
  16.     return amount;
  17. end
  18.  
  19.  
  20. while true do
  21.     local event = {os.pullEvent()}
  22.     print("1Guthaben: " .. getGuthaben() )
  23. end
Advertisement
Add Comment
Please, Sign In to add comment