Version 0.3.2
LÖVE Documentation
OverviewLicenseCreditsInstallingGetting started
Devices
love.graphicslove.audiolove.keyboardlove.mouselove.filesystemlove.timerlove.system
Types
AnimationColorFontFileImageMusicParticleSystemSound
Callbacks
loadupdatedrawmousepressedmousereleasedkeypressedkeyreleased
Miscellaneous
ConstantsConfig filesKeyboard shortcuts
Function
love.keyboard.isDown( key )
Checks whether a certain key is down.
Usage
love.keyboard.isDown( key )
Arguments
keyThe key in question.
Returns
booleanWhether the passed key is pressed down.
Examples
Example 1: Common use of the keyboard. -- Say we have a player table like so:
player = { x = 200, y = 200 }

function update(dt)
   -- We then check each key, and move the player
   -- accordingly (100px/second).
   if love.keyboard.isDown(love.key_left) then
      player.x = player.x - 100 * dt
   end
   if love.keyboard.isDown(love.key_right) then
      player.x = player.x + 100 * dt
   end
   if love.keyboard.isDown(love.key_up) then
      player.y = player.y - 100 * dt
   end
   if love.keyboard.isDown(love.key_down) then
      player.y = player.y + 100 * dt
   end
end