peripheral event

peripheral
Event
Returns
  • name : string The side or network name of the peripheral that was attached.

Source CC:Tweaked

Occurs every time a peripheral is attached.

ExampleAlert on peripheral attachment
Waits for a peripheral to be attached and alerts the user what type of peripheral was attached.
Code
<nowiki>
local event, peripheral_name = os.pullEvent("peripheral")
local peripheral_type = peripheral.getType(peripheral_name)
print("A", peripheral_type, "has been attached.")
    </nowiki>
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.