Difference between revisions of "love.keypressed"
(Add an example) |
|||
Line 10: | Line 10: | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | == Examples == | ||
+ | Exit the game when the player presses the Escape key. | ||
+ | <source lang="lua"> | ||
+ | function love.keypressed(key, unicode) | ||
+ | if key == "escape" then | ||
+ | love.event.push('q') | ||
+ | end | ||
+ | end | ||
+ | </source> | ||
== See Also == | == See Also == | ||
* [[parent::love]] | * [[parent::love]] |
Revision as of 20:30, 26 September 2011
Callback function triggered when a key is pressed.
Function
Synopsis
love.keypressed( key, unicode )
Arguments
KeyConstant key
- Character of the key pressed.
number unicode
- The unicode number of the key pressed.
Returns
Nothing.
Examples
Exit the game when the player presses the Escape key.
function love.keypressed(key, unicode)
if key == "escape" then
love.event.push('q')
end
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info