Advertisement
mahldcat

Untitled

Jul 17th, 2024 (edited)
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. -- Initialize an empty table to store the list of modems
  2. local modems = {}
  3.  
  4. -- Get a list of all connected peripherals
  5. local peripherals = peripheral.getNames()
  6.  
  7. -- Iterate through the list of peripherals to find modems
  8. for _, name in ipairs(peripherals) do
  9. print("peripheral " .. name)
  10. if peripheral.getType(name) == "modem" then
  11. table.insert(modems, name)
  12. end
  13. end
  14.  
  15. -- Print the list of modems
  16. print("Connected modems:")
  17. for _, modem in ipairs(modems) do
  18. print(modem)
  19. end
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement