Difference between revisions of "love.event.poll"

m (Modified example code to love.event instead of love.events)
(Updated example.)
Line 1: Line 1:
Gets an iterator for messages in the event queue.
+
Returns an iterator for messages in the event queue.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
Line 8: Line 8:
 
None.
 
None.
 
=== Returns ===
 
=== Returns ===
{{param|function|i|Iterator function usable in for loop.}}
+
{{param|function|i|Iterator function usable in a for loop.}}
 
== Examples ==
 
== Examples ==
 
=== Checking for events ===
 
=== Checking for events ===
 
<source lang="lua">
 
<source lang="lua">
for e,a,b,c in love.event.poll() do
+
for e, a, b, c, d in love.event.poll() do
if e == "q" then
+
if e == "quit" then
 
-- Quit!
 
-- Quit!
 
end
 
end
Line 22: Line 22:
 
* [[love.event.wait]]
 
* [[love.event.wait]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Gets an iterator for messages in the event queue.}}
+
{{#set:Description=Returns an iterator for messages in the event queue.}}
 
{{#set:Since=000}}
 
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.event.poll}}
 
{{i18n|love.event.poll}}

Revision as of 22:07, 8 April 2012

Returns an iterator for messages in the event queue.

Function

Synopsis

i = love.event.poll( )

Arguments

None.

Returns

function i
Iterator function usable in a for loop.

Examples

Checking for events

for e, a, b, c, d in love.event.poll() do
	if e == "quit" then
		-- Quit!
	end	
end

See Also


Other Languages