MinoCraft72

searchCell

Mar 16th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. --Config:
  2.  
  3.   reactorSide = "top"
  4.  
  5. --Function:
  6.  
  7. reactor = peripheral.wrap(reactorSide)
  8. soloCell = "reactorUraniumSimple"
  9. dualCell = "reactorUraniumDual"
  10. quadCell = "reactorUraniumQuad"
  11. slotCell = { }
  12.  
  13. function searchCell()
  14.  local reactorSize = reactor.getInventorySize()
  15.  print(reactorSize)
  16.   for slot = 1, reactorSize do
  17.    local slotData = reactor.getStackInSlot(slot)
  18.     if slotData ~= nil then
  19.       for k,v in pairs(slotData) do
  20.        name = slotData.name
  21.        dmg = slotData.dmg
  22.       end
  23.       if name == dualCell or name == quadCell
  24.       or name == soloCell then
  25.        print(slot..": "..name)
  26.        table.insert(slotCell, slot)
  27.        sleep(1)
  28.        print(slotCell)
  29.       end      
  30.       if slotCell ~= nil then
  31.        file = fs.open("log.txt","w")
  32.        file.write(slotCell)
  33.        file.close()
  34.       end
  35.     end
  36.   end
  37. end
  38. --Prog:
  39.  if not fs.exists("log.txt") then
  40.   searchCell()
  41.    for k,v in pairs(slotCell) do
  42.     print(k..": "..tostring(v))
  43.     sleep(1)
  44.    end
  45.  end
  46.  sleep(5)
  47.  shell.exit()
Advertisement
Add Comment
Please, Sign In to add comment