Difference between revisions of "Modem.isWireless"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with "{{Function |name=modem.isWireless |returns={{type|boolean}} isWireless |api=Modem |addon=ComputerCraft |desc=Returns true if a modem is wireless, false if it's wired. |example...")
 
m (Expanded)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{Function
 
{{Function
|name=modem.isWireless
+
|name=''modem''.isWireless
|returns={{type|boolean}} isWireless
+
|returns={{type|boolean}} is modem wireless?
 
|api=Modem
 
|api=Modem
 
|addon=ComputerCraft
 
|addon=ComputerCraft
Line 7: Line 7:
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Returns true if a modem is wireless, false if it's wired.
+
|desc=Prints whether the modem on top of the computer is wireless or wired.
|code=modem.isWireless()
+
|code= local modem = [[peripheral.wrap]]("top")
 +
 +
if modem.isWireless() then
 +
  print("The modem on top of the computer is wireless.")
 +
else
 +
  print("The modem on top of the computer is wired.")
 +
end
 
}}
 
}}
 
}}
 
}}
 +
 +
[[Category:API_Functions]]

Latest revision as of 16:05, 9 April 2014

Grid Redstone.png  Function modem.isWireless
Returns true if a modem is wireless, false if it's wired.
Syntax modem.isWireless()
Returns boolean is modem wireless?
Part of ComputerCraft
API Modem

Examples

Grid paper.png  Example
Prints whether the modem on top of the computer is wireless or wired.
Code
local modem = peripheral.wrap("top")

if modem.isWireless() then
  print("The modem on top of the computer is wireless.")
else
  print("The modem on top of the computer is wired.")
end