Advertisement
fatboychummy

TakeItems.lua

May 30th, 2020
1,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. local function getItems()
  2.   print("Collecting items.")
  3.   local tTurtles = {peripheral.find("turtle")}
  4.   local sChest
  5.  
  6.   for _, sName in ipairs(peripheral.getNames()) do
  7.     if sName:find("chest") then
  8.       sChest = sName
  9.       break
  10.     end
  11.   end
  12.   if not sChest then
  13.     error("Couldn't find chest!")
  14.   end
  15.   for i = 1, #tTurtles do
  16.     local tCurrent = tTurtles[i]
  17.     for o = 1, 16 do
  18.       tCurrent.pushItems(sChest, o, 1, o)
  19.     end
  20.   end
  21. end
  22.  
  23. getItems()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement