SHARE
TWEET

Inv Manager Pull

x8-bitx Dec 7th, 2019 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tArgs = {...}
  2. --Receive Container
  3. cont = "minecraft:ender chest_11"
  4. --Virtual Inv Container
  5. contl = "inv/"
  6. con = fs.list(contl)
  7. --placeholder
  8. st = ""
  9. --Seperate string by char Return table
  10. function mysplit (inputstr, sep)
  11.   if sep == nil then
  12.     sep = "%s"
  13.   end
  14.   local t={}
  15.   for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  16.     table.insert(t, str)
  17.   end
  18.   return t
  19. end
  20. if tArgs[1] ~= nil then
  21.   for i = 1, #tArgs do
  22.     st = st..""..tArgs[i].." "
  23.   end
  24.   rItem = string.gsub(st, '[ \t]+%f[\r\n%z]', '')
  25. else
  26.   rItem = tArgs[1]
  27. end
  28. if rItem == "" then
  29.   print("INSERT ITEM TO SEARCH FOR")
  30. else
  31.   for _,v in pairs(con) do
  32.     fcon = fs.open(contl..v, "r")
  33.     repeat
  34.       st = fcon.readLine()
  35.       if st ~= nil then
  36.         local lineCon = mysplit(st,"-")
  37.         local t,tt = string.find(string.lower(lineCon[3]), rItem)
  38.         if t ~= nul then
  39.           local sctn = peripheral.wrap(lineCon[1])
  40.           sctn.pushItems(cont,tonumber(lineCon[2]))
  41.         end
  42.       end
  43.       if st == nil then
  44.         done = true
  45.       end
  46.     until done == true
  47.       done = false
  48.   end
  49. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top