Skip to main content

Event

Description:

  Manages events, like keypresses.

pump

Type: Function.

Description:

  Dora owns the platform event pump; this does not pump a second OS queue. Pump events into the event queue. This is a low-level function, and is usually not called by the user, but by love.run. Note that this does need to be called for any OS to think you're still running, and if you want to handle OS-generated events at all (think callbacks).

Signature:

pump: function()

poll

Type: Function.

Description:

  Returns an iterator for messages in the event queue.

Signature:

poll: function(): function(): any...

Returns:

Return TypeDescription
function or any...Iterator function usable in a for loop.

wait

Type: Function.

Description:

  Like love.event.poll(), but blocks until there is an event in the queue.

Signature:

wait: function(): any...

Returns:

Return TypeDescription
any...The name of event.

push

Type: Function.

Description:

  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.

Signature:

push: function(name: string, args: any...): boolean

Parameters:

ParameterTypeDescription
namestringThe name of the event.
argsany...First event argument. (Default: nil.)

clear

Type: Function.

Description:

  Clears the event queue.

Signature:

clear: function()

quit

Type: Function.

Description:

  Adds the quit event to the queue.

-- The quit event is a signal for the event handler to close LÖVE. It's possible to abort the exit process with the love.quit callback.

Signature:

quit: function(exit_status?: number): boolean

Parameters:

ParameterTypeDescription
exit_statusnumberThe program exit status to use when closing the application. (Default: 0.)

Returns:

Return TypeDescription
booleanAlways returns true after the quit event is queued.

quit

Type: Function.

Description:

  Adds the quit event to the queue.

-- The quit event is a signal for the event handler to close LÖVE. It's possible to abort the exit process with the love.quit callback.

Signature:

quit: function(reason: string): boolean

Parameters:

ParameterTypeDescription
reasonstringTells the default love.run to exit and restart the game without relaunching the executable.

Returns:

Return TypeDescription
booleanAlways returns true after the restart quit event is queued.