Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function takeItems(perph, name, amount)
- local f = 1
- local b = nil
- local m = 0
- local d = {}
- local s = perph.getInventorySize()
- local c = "slot?"
- local q = amount
- local n = 0
- for f = 1, s, 1 do
- b = perph.getStackInSlot(f, false)
- c = "slot" .. f
- if type(b) == nil then
- d[c] = "empty"
- elseif type(b) == "nil" then
- d[c] = "empty"
- else
- d[c] = b
- if q == 0 then
- return "Successfully found " .. amount .. " " .. name
- elseif b.display_name == name then
- m = perph.pushItem("up",f,q)
- q = q - m
- end
- if q == 0 then
- return "Successfully found " .. amount .. " " .. name
- end
- end
- end
- n = amount - q
- return "Only found " .. n .. " " .. name
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement