Difference between revisions of "Peripheral (event)"
From ComputerCraft Wiki
m (Please don't remove {{NeedsWork}} without proofreading document contents.) |
(better coding habits) |
||
Line 1: | Line 1: | ||
{{Event | {{Event | ||
|name=peripheral | |name=peripheral | ||
− | |desc=Fired when a peripheral is connected | + | |desc=Fired when a peripheral is connected to the computer locally or remotely (over Network Cables). |
|return1=The [[String_(type)|string]] value of the side of the connected peripheral. | |return1=The [[String_(type)|string]] value of the side of the connected peripheral. | ||
}} | }} | ||
Line 8: | Line 8: | ||
|code= | |code= | ||
while true do | while true do | ||
− | event, side = os.pullEvent("peripheral") | + | local event, side = os.pullEvent("peripheral") |
print("A "..peripheral.getType(side).." has been attached on the "..side) | print("A "..peripheral.getType(side).." has been attached on the "..side) | ||
end | end | ||
Line 16: | Line 16: | ||
|code= | |code= | ||
while true do | while true do | ||
− | event, side = os.pullEvent("peripheral") | + | local event, side = os.pullEvent("peripheral") |
if peripheral.getType(side) == "modem" then | if peripheral.getType(side) == "modem" then | ||
print("A modem has been attached!") | print("A modem has been attached!") | ||
− | |||
end | end | ||
end | end | ||
}} | }} |
Revision as of 10:08, 28 October 2013
Event peripheral | |
Fired when a peripheral is connected to the computer locally or remotely (over Network Cables). | |
Returned Object 1 | The string value of the side of the connected peripheral. |