Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getmodems(mode)
- mode = mode or "default"
- if mode == "default" then
- allp = peripheral.getNames()
- d = {}
- x = 0
- for i,value in ipairs(allp) do
- c = peripheral.getType(value)
- if c == "modem" then
- c = peripheral.wrap(value)
- x = x + 1
- d[x] = c
- end
- end
- d["a"] = x
- d["amount"] = x
- return d
- elseif mode == "sides" or mode =="s" then
- allp = peripheral.getNames()
- d = {}
- x = 0
- for i,value in ipairs(allp) do
- c = peripheral.getType(value)
- if c == "modem" then
- x = x + 1
- d[x] = value
- end
- end
- d["a"] = x
- d["amount"] = x
- return d
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement