Difference between revisions of "love.event.push"
(Specify what types of arguments are supported for the events) |
|||
(16 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{newin|[[0.6.0]]|060|type=function}} | ||
+ | Adds an event to the event queue. | ||
+ | See [[Variant]] for the list of supported types for the arguments. | ||
+ | |||
+ | 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( | + | love.event.push( n, a, b, c, d, e, f, ... ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param|Event| | + | {{param|Event|n|The name of the event.}} |
− | {{param| | + | {{param|Variant|a (nil)|First event argument.}} |
− | {{param| | + | {{param|Variant|b (nil)|Second event argument.}} |
− | {{param| | + | {{param|Variant|c (nil)|Third event argument.}} |
+ | {{New_feature|0.8.0| | ||
+ | {{param|Variant|d (nil)|Fourth event argument.}} | ||
+ | |080}} | ||
+ | {{New_feature|0.10.0| | ||
+ | {{param|Variant|e (nil)|Fifth event argument.}} | ||
+ | {{param|Variant|f (nil)|Sixth event argument.}} | ||
+ | {{param|Variant|... (nil)|Further event arguments may follow.}} | ||
+ | |100}} | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
== Examples == | == Examples == | ||
− | + | {{New_feature|0.8.0| | |
<source lang="lua"> | <source lang="lua"> | ||
function love.keypressed(k) | function love.keypressed(k) | ||
if k == 'escape' then | if k == 'escape' then | ||
− | love.event.push(' | + | love.event.push('quit') -- Quit the game. |
end | end | ||
end | end | ||
− | </source> | + | </source>}} |
+ | {{Removed_new_feature|0.6.0|0.7.2| | ||
+ | <source lang="lua"> | ||
+ | function love.keypressed(k) | ||
+ | if k == 'escape' then | ||
+ | love.event.push('q') -- Quit the game. | ||
+ | end | ||
+ | end | ||
+ | </source>}} | ||
== See Also == | == See Also == | ||
* [[parent::love.event]] | * [[parent::love.event]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description=}} | + | {{#set:Description=Adds an event to the event queue.}} |
+ | {{#set:Since=000}} | ||
+ | == Other Languages == | ||
+ | {{i18n|love.event.push}} |
Latest revision as of 13:17, 17 July 2020
Available since LÖVE 0.6.0 |
This function is not supported in earlier versions. |
Adds an event to the event queue.
See Variant for the list of supported types for the arguments.
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
Returns
Nothing.
Examples
Available since LÖVE 0.8.0
function love.keypressed(k)
if k == 'escape' then
love.event.push('quit') -- Quit the game.
end
end
function love.keypressed(k)
if k == 'escape' then
love.event.push('q') -- Quit the game.
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