Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This API is designed for easy to use peripherals
- local peripherals = {}
- local function getPeripherals()
- peripherals = {}
- for _ , side in pairs( rs.getSides() ) do
- if peripheral.isPresent(side) then
- local _ = {side, peripheral.getType(side)}
- table.insert(peripherals, _)
- end
- end
- end
- function returnPeripherals()
- return peripherals
- end
- local monitors = {}
- local function getMonitors()
- monitors = {}
- for key, value in pairs(peripherals) do
- if value[2] == "monitor" then
- local monitor = peripheral.wrap(value[1])
- local Color = monitor.isColor()
- local SizeX, SizeY = monitor.getSize()
- local Side = value[1]
- local _ = {monitor, Color, SizeX, SizeY}
- table.insert(monitors, _)
- end
- end
- end
- function returnMonitors()
- return monitors
- end
- function loadMoniter(side)
- for key, value in pairs(monitors) do
- if value[2] == side then
- return monitors[key]
- end
- return nil
- end
- end
- function reloadPeriperals()
- getPeripherals()
- getMonitors()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement