Difference between revisions of "Os.getComputerLabel"

From ComputerCraft Wiki
Jump to: navigation, search
(Add return type, example output, and more notes)
m (Fixed/Expanded)
 
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=os.getComputerLabel
 
|name=os.getComputerLabel
|returns=[[string (type)|string]] the label of the Computer
+
|returns={{type|string}} the label of the Computer or {{type|nil}} if there is no label set
 
|api=OS
 
|api=OS
 
|addon=ComputerCraft
 
|addon=ComputerCraft
Line 9: Line 9:
 
{{Example
 
{{Example
 
|desc=prints the Computer Label
 
|desc=prints the Computer Label
|code=print(os.getComputerLabel())
+
|code=[[print]]('''os.getComputerLabel()''')
|output=My Computer
+
|output=The computer's label or nothing if there is no label set
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Latest revision as of 22:33, 3 June 2014


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 or nil if there is no label set
Part of ComputerCraft
API OS

Examples

Grid paper.png  Example
prints the Computer Label
Code
print(os.getComputerLabel())
Output The computer's label or nothing if there is no label set