From 0ebcf3145047e3e680013f9770e34d5284537280 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 15 Mar 2026 15:05:27 -0400 Subject: [PATCH] Upload files to "/" --- listDevicesByType.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 listDevicesByType.lua diff --git a/listDevicesByType.lua b/listDevicesByType.lua new file mode 100644 index 0000000..f4bee6d --- /dev/null +++ b/listDevicesByType.lua @@ -0,0 +1,25 @@ +-- List all peripherals grouped by type +local peripherals = peripheral.getNames() +local grouped = {} + +-- Group peripherals by type +for _, name in ipairs(peripherals) do + local pType = peripheral.getType(name) + if not grouped[pType] then + grouped[pType] = {} + end + table.insert(grouped[pType], name) +end + +-- Display grouped results +print("=== Network Devices ===") +print("Total devices found: " .. #peripherals) +print("") + +for pType, devices in pairs(grouped) do + print(string.format("[%s] (%d found)", pType, #devices)) + for _, name in ipairs(devices) do + print(" - " .. name) + end + print("") +end \ No newline at end of file