peripheral.getType

Returns the type of peripheral attached at the specified side or network name. Returns nil when no peripheral is attached at the specified side or network name.

ExampleGet peripheral type
Gets and prints the type of peripheral attached to the top side.
Code
print(peripheral.getType("top"))
Output If a wireless modem was attached, the output would be 'modem'.

peripheral.getType
Function
Syntax
peripheral.getType(
  • side or network name : string
)

Returns boolean result
API peripheral
Source Lua (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.