Difference between revisions of "love.event.poll"
(Keeping the 0.7.2 example.) |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{newin|[[0.6.0]]|060|type=function}} | ||
Returns an iterator for messages in the event queue. | Returns an iterator for messages in the event queue. | ||
== Function == | == Function == | ||
Line 10: | Line 11: | ||
{{param|function|i|Iterator function usable in a for loop.}} | {{param|function|i|Iterator function usable in a for loop.}} | ||
== Examples == | == Examples == | ||
+ | === Checking for events in 0.10.0 === | ||
+ | <source lang="lua"> | ||
+ | for n, a, b, c, d, e, f in love.event.poll() do | ||
+ | if n == "quit" then | ||
+ | -- Quit! | ||
+ | end | ||
+ | end | ||
+ | </source> | ||
=== Checking for events in 0.8.0 === | === Checking for events in 0.8.0 === | ||
<source lang="lua"> | <source lang="lua"> |
Latest revision as of 22:33, 17 November 2019
Available since LÖVE 0.6.0 |
This function is not supported in earlier versions. |
Returns an iterator for messages in the event queue.
Contents
Function
Synopsis
i = love.event.poll( )
Arguments
None.
Returns
function i
- Iterator function usable in a for loop.
Examples
Checking for events in 0.10.0
for n, a, b, c, d, e, f in love.event.poll() do
if n == "quit" then
-- Quit!
end
end
Checking for events in 0.8.0
for e, a, b, c, d in love.event.poll() do
if e == "quit" then
-- Quit!
end
end
Checking for events in 0.7.2
for e, a, b, c in love.event.poll() do
if e == "q" then
-- Quit!
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