Difference between revisions of "love.event.push"

(Updated page to account the two parameter slots added because of touch events in 0.10.0.)
(Fixed how the parameters work from 0.10 onwards, mentioned it in the main text.)
Line 1: Line 1:
Adds an event to the event queue.
+
Adds an event to the event queue.<br>From 0.10.0 onwards, you may pass an arbitrary amount of arguments with this function, though the default callbacks don't ever use more than six.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
love.event.push( n, a, b, c, d, e, f )
+
love.event.push( n, a, b, c, d, e, f, ... )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|Event|e|The name of the event.}}
+
{{param|Event|n|The name of the event.}}
 
{{param|Variant|a (nil)|First event argument.}}
 
{{param|Variant|a (nil)|First event argument.}}
 
{{param|Variant|b (nil)|Second event argument.}}
 
{{param|Variant|b (nil)|Second event argument.}}
Line 16: Line 16:
 
{{param|Variant|e (nil)|Fifth event argument.}}
 
{{param|Variant|e (nil)|Fifth event argument.}}
 
{{param|Variant|f (nil)|Sixth event argument.}}
 
{{param|Variant|f (nil)|Sixth event argument.}}
 +
{{param|Variant|... (nil)|Further event arguments may follow.}}
 
|100}}
 
|100}}
 
=== Returns ===
 
=== Returns ===

Revision as of 16:10, 21 June 2017

Adds an event to the event queue.
From 0.10.0 onwards, you may pass an arbitrary amount of arguments with this function, though the default callbacks don't ever use more than six.

Function

Synopsis

love.event.push( n, a, b, c, d, e, f, ... )

Arguments

Event n
The name of the event.
Variant a (nil)
First event argument.
Variant b (nil)
Second event argument.
Variant c (nil)
Third event argument.
Available since LÖVE 0.8.0
Variant d (nil)
Fourth event argument.


Available since LÖVE 0.10.0
Variant e (nil)
Fifth event argument.
Variant f (nil)
Sixth event argument.
Variant ... (nil)
Further event arguments may follow.

Returns

Nothing.

Examples

Quitting a game in 0.8.0

function love.keypressed(k)
	if k == 'escape' then
		love.event.push('quit') -- Quit the game.
	end	
end

Quitting a game in 0.7.2

function love.keypressed(k)
	if k == 'escape' then
		love.event.push('q') -- Quit the game.
	end	
end

See Also


Other Languages