Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ============================================
- -- PERIPHERAL SCANNER
- -- ============================================
- -- Run this first to find peripheral names
- -- ============================================
- print("=== PERIPHERAL SCANNER ===")
- print("")
- local names = peripheral.getNames()
- if #names == 0 then
- print("No peripherals found!")
- print("Make sure blocks are adjacent to the computer.")
- else
- print("Found " .. #names .. " peripheral(s):")
- print("")
- for _, name in ipairs(names) do
- local pType = peripheral.getType(name)
- local methods = peripheral.getMethods(name)
- print("Name: " .. name)
- print(" Type: " .. pType)
- -- Check if it's an inventory
- local isInventory = false
- for _, method in ipairs(methods) do
- if method == "list" or method == "getItemDetail" then
- isInventory = true
- break
- end
- end
- if isInventory then
- print(" Has inventory: YES")
- local inv = peripheral.wrap(name)
- local size = inv.size and inv.size() or "?"
- print(" Slots: " .. tostring(size))
- -- Count items
- local items = inv.list()
- local count = 0
- for _ in pairs(items or {}) do
- count = count + 1
- end
- print(" Items: " .. count .. " stacks")
- end
- print("")
- end
- end
- print("Copy the names you need into startup.lua CONFIG section")
Add Comment
Please, Sign In to add comment