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