Peripheral

From ComputerCraft
Jump to: navigation, search
EventEventperipheral
Occurs every time a peripheral is attached.
Returns
Part of CC:Tweaked
See also Peripheral detach event
ExampleExampleAlert on peripheral attachment
Waits for a peripheral to be attached and alerts the user what type of peripheral was attached.
Code
local event, peripheral_name = os.pullEvent("peripheral")
local peripheral_type = peripheral.getType(peripheral_name)
print("A", peripheral_type, "has been attached.")
EventEventperipheral_detach
Occurs every time a peripheral is detached.
Returns
Part of CC:Tweaked
See also Peripheral event
ExampleExampleAlert on peripheral detachment
Waits for a peripheral to be detached and alerts the user when it occured.
Code
local event, peripheral_name = os.pullEvent("peripheral_detach")
print("Peripheral", peripheral_name, "has been detached.")