Advertisement
maxence01

Untitled

May 30th, 2024 (edited)
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.44 KB | None | 0 0
  1. local c = require("component")
  2. local ct = c.transposer
  3. local shell = require("shell")
  4. local sides = require("sides")
  5.  
  6. -- CHANGE THESE BASED ON YOUR SETUP
  7. local storageside = sides.down
  8. local chestside = sides.up
  9. -- END CONFIG
  10.  
  11. local args, opts = shell.parse(...)
  12.  
  13. if args[1] then
  14.     local searchfor = args[1]
  15.     local count = args[2]
  16.     local num = args[3]
  17.     local counted = 0
  18.     if not tonumber(searchfor) then
  19.         local i = 0
  20.         for i =1, (ct.getInventorySize(storageside)) do
  21.             local item = ct.getStackInSlot(storageside, i)
  22.  
  23.             if item then
  24.                 if string.find(item.name .. "^" .. item.label .. "^", searchfor) then
  25.                     print(i .. ": " .. item.name .. " - " .. item.label .. " (" .. item.size .. ")")
  26.                     counted = counted + 1
  27.                     slot = i
  28.                 end
  29.             end
  30.         end
  31.     else
  32.         slot = tonumber(searchfor)
  33.         number = tonumber(count)
  34.         numbers = tonumber(num)
  35.         counted = 1
  36.     end
  37.  
  38.     if counted == 1 then
  39.         if args[2] then
  40.             if args[3]
  41.                 local h = 0
  42.                 for h = number, 1, -1 do
  43.                     ct.transferItem(storageside, chestside, numbers, slot)
  44.                 end
  45.             end
  46.         end
  47.     end
  48. else  -- No arguments indicate send everything back
  49.     for i = ct.getInventorySize(chestside), 1, -1 do
  50.         ct.transferItem(chestside, storageside, 64, i)
  51.     end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement