Difference between revisions of "Peripheral (event)"
From ComputerCraft Wiki
m (Please don't remove {{NeedsWork}} without proofreading document contents.) |
m (slight wording tweak) |
||
(One intermediate revision by the same user not shown) | |||
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= | + | |return1=A [[String_(type)|string]] of the side/name of the connected peripheral. |
}} | }} | ||
{{Example | {{Example | ||
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 | ||
}} | }} |
Latest revision as of 11:19, 25 March 2014
Event peripheral | |
Fired when a peripheral is connected to the computer locally or remotely (over Network Cables). | |
Returned Object 1 | A string of the side/name of the connected peripheral. |