Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pack(...)
- retVal = {}
- for i, v in ipairs(arg) do
- table.insert(retVal, v)
- end
- return retVal
- end
- function getAllPeripherals(filter)
- retVal = {}
- filter = filter or false
- peripherals = peripheral.getNames()
- if not filter then
- return peripherals
- end
- for i,v in ipairs(peripherals) do
- if peripheral.getType(v) == filter then
- table.insert(retVal, peripheral.wrap(v))
- end
- end
- return retVal
- end
- function writeToMonitors(monitors, word)
- for i, v in ipairs(monitors) do
- v.setCursorPos(1,1)
- v.write(word)
- end
- end
- monitors = getAllPeripherals("monitor")
- writeToMonitors(monitors, "Hello, World!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement