Difference between revisions of "Keys.getName"

From ComputerCraft Wiki
Jump to: navigation, search
(New page)
 
(Type-templateify, add nil return value possibility on failure, and clarify description)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=keys.getName
 
|name=keys.getName
|args=[[int (type)|int]] code
+
|args={{type|int}} code
 
|api=keys
 
|api=keys
|returns=[[string (type)|string]] the name of the key
+
|returns={{type|string}} the name of the key, or [[nil]] if not a valid key code
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Looks up the name of a key given its numerical key code.
+
|desc=Translates a numerical key code to a human-readable name. The human-readable name is one of the constants in the [[Keys (API)|keys API]].
 
|examples=
 
|examples=
 
{{Example
 
{{Example

Revision as of 23:21, 5 May 2013


Grid Redstone.png  Function keys.getName
Translates a numerical key code to a human-readable name. The human-readable name is one of the constants in the keys API.
Syntax keys.getName(int code)
Returns string the name of the key, or nil if not a valid key code
Part of ComputerCraft
API keys

Examples

Grid paper.png  Example
Look up the name of key code 42.
Code
print(keys.getName(42))
Output leftShift