Difference between revisions of "Os.getComputerLabel"

From ComputerCraft Wiki
Jump to: navigation, search
m (Updated references from "os" to "OS")
(Add return type, example output, and more notes)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=os.getComputerLabel
 
|name=os.getComputerLabel
|returns=the label of the Computer
+
|returns=[[string (type)|string]] the label of the Computer
 
|api=OS
 
|api=OS
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=returns the label of the computer this command is executed on.
+
|desc=Reads the label from the executing computer. This is the label that shows up in the item tooltip if the computer is broken. The label can be set with [[os.setComputerLabel]]. This function is also available as [[os.computerLabel]].
 
|examples=
 
|examples=
 
{{Example
 
{{Example
 
|desc=prints the Computer Label
 
|desc=prints the Computer Label
|code=term.write(os.getComputerLabel())
+
|code=print(os.getComputerLabel())
 +
|output=My Computer
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Revision as of 20:02, 21 April 2013


Grid Redstone.png  Function os.getComputerLabel
Reads the label from the executing computer. This is the label that shows up in the item tooltip if the computer is broken. The label can be set with os.setComputerLabel. This function is also available as os.computerLabel.
Syntax os.getComputerLabel()
Returns string the label of the Computer
Part of ComputerCraft
API OS

Examples

Grid paper.png  Example
prints the Computer Label
Code
print(os.getComputerLabel())
Output My Computer