modem.getTypeRemote

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function modem.getTypeRemote
Returns the type of peripheral that's connected to the Wired Modem, under the specified network name. Note that peripheral.getType() can do exactly the same thing for ALL peripherals which are attached to the system, through modems or otherwise.
Syntax modem.getTypeRemote(string peripheralName)
Returns string peripheralType
Part of ComputerCraft
API Modem

Examples

Grid paper.png  Example
Prints the type of the first peripheral detected through the modem.
Code
local modem = peripheral.wrap("left")  -- Or whatever side the modem is connected to.

print( modem.getTypeRemote( modem.getNamesRemote()[1] or "none") )
Output Either "computer", "drive", "monitor", "printer", or nothing if nothing is connected.