Difference between revisions of "love.event.poll"

(Updated example.)
(Keeping the 0.7.2 example.)
Line 10: Line 10:
 
{{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 ===
+
=== Checking for events in 0.8.0 ===
 
<source lang="lua">
 
<source lang="lua">
 
for e, a, b, c, d in love.event.poll() do
 
for e, a, b, c, d in love.event.poll() do
 
if e == "quit" then
 
if e == "quit" then
 +
-- Quit!
 +
end
 +
end
 +
</source>
 +
=== Checking for events in 0.7.2 ===
 +
<source lang="lua">
 +
for e, a, b, c in love.event.poll() do
 +
if e == "q" then
 
-- Quit!
 
-- Quit!
 
end
 
end

Revision as of 22:12, 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 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