Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize an empty table to store the list of modems
- local modems = {}
- -- Get a list of all connected peripherals
- local peripherals = peripheral.getNames()
- -- Iterate through the list of peripherals to find modems
- for _, name in ipairs(peripherals) do
- print("peripheral " .. name)
- if peripheral.getType(name) == "modem" then
- table.insert(modems, name)
- end
- end
- -- Print the list of modems
- print("Connected modems:")
- for _, modem in ipairs(modems) do
- print(modem)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement