Difference between revisions of "love.keyboard.isDown"

Line 9: Line 9:
 
=== Returns ===
 
=== Returns ===
 
{{param|boolean|down|True if the key is down, false if not.}}
 
{{param|boolean|down|True if the key is down, false if not.}}
 +
== Function ==
 +
{{newin|0.7.2|type=variant}}
 +
=== Synopsis ===
 +
<source lang="lua">
 +
anyDown = love.keyboard.isDown( key1, key2, key3, ... )
 +
</source
 +
=== Arguments ===
 +
{{param|KeyConstant|keyN|A key to check.}}
 +
=== Returns ===
 +
{{param|boolean|anyDown|True if any supplied key is down, false if not.}}
 
== Examples ==
 
== Examples ==
 
=== Quit on hitting escape ===
 
=== Quit on hitting escape ===

Revision as of 15:54, 6 April 2011

Checks whether a certain key is down.

Function

Synopsis

down = love.keyboard.isDown( key )

Arguments

KeyConstant key
The key to check.

Returns

boolean down
True if the key is down, false if not.

Function

Available since LÖVE 0.7.2
This variant is not supported in earlier versions.

Synopsis

anyDown = love.keyboard.isDown( key1, key2, key3, ... )
</source
=== Arguments ===
{{param|KeyConstant|keyN|A key to check.}}
=== Returns ===
{{param|boolean|anyDown|True if any supplied key is down, false if not.}}
== Examples ==
=== Quit on hitting escape ===
<source lang="lua">
function love.keypressed(k)
	if k == 'escape' then
		love.event.push('q') -- quit the game
	end	
end

See Also


Other Languages