Difference between revisions of "Disk (event)"
From ComputerCraft Wiki
(Slightly better description updated for network cables, also better coding habits) |
(added links and some cleanup) |
||
| Line 1: | Line 1: | ||
{{Event | {{Event | ||
|name=disk | |name=disk | ||
| − | |desc=Fired when a | + | |desc=Fired when a [[Floppy Disk]] is inserted into any [[Disk Drive]] connected to the computer locally or remotely (over Network Cables). |
| − | |return1=The [[String_(type)|String]] value of the side/name of the | + | |return1=The [[String_(type)|String]] value of the side/name of the [[Disk Drive]]. |
}} | }} | ||
{{Example | {{Example | ||
| Line 8: | Line 8: | ||
|code= | |code= | ||
while true do | while true do | ||
| − | local event, side = os.pullEvent( | + | local event, side = os.pullEvent() |
if event == "disk" then | if event == "disk" then | ||
| − | print("Disk | + | print("Disk was inserted: "..side) |
end | end | ||
end | end | ||
| − | |||
}} | }} | ||
Latest revision as of 10:06, 28 October 2013
| Fired when a Floppy Disk is inserted into any Disk Drive connected to the computer locally or remotely (over Network Cables). | |
| Returned Object 1 | The String value of the side/name of the Disk Drive. |
| Print a message when a disk is inserted into a connected disk drive. | |
| Code |
while true do
local event, side = os.pullEvent()
if event == "disk" then
print("Disk was inserted: "..side)
end
end
|