love

When beginning to write games using LÖVE, the most important parts of the API are the callbacks: love.load to do one-time setup of your game, love.update which is used to manage your game's state frame-to-frame, and love.draw which is used to render the game state onto the screen.

More interactive games will override additional callbacks in order to handle input from the user, and other aspects of a full-featured game.

LÖVE provides default placeholders for these callbacks, which you can override inside your own code by creating your own function with the same name as the callback:

-- Load some default values for our rectangle.
function love.load()
    x, y, w, h = 20, 20, 60, 20
end
 
-- Increase the size of the rectangle every frame.
function love.update(dt)
    w = w + 1
    h = h + 1
end
 
-- Draw a coloured rectangle.
function love.draw()
    love.graphics.setColor(0, 0.4, 0.4)
    love.graphics.rectangle("fill", x, y, w, h)
end

Modules

love.audio Provides an interface to output sound to the user's speakers.
love.data Provides functionality for creating and transforming data.
Error creating thumbnail: Unable to save thumbnail to destination
11.0
love.event Manages events, like keypresses.
Error creating thumbnail: Unable to save thumbnail to destination
0.6.0
love.filesystem Provides an interface to the user's filesystem.
love.font Allows you to work with fonts.
Error creating thumbnail: Unable to save thumbnail to destination
0.7.0
love.graphics Drawing of shapes and images, management of screen geometry.
love.image Provides an interface to decode encoded image data.
love.joystick Provides an interface to connected joysticks.
love.keyboard Provides an interface to the user's keyboard.
love.math Provides system-independent mathematical functions.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.mouse Provides an interface to the user's mouse.
love.physics Can simulate 2D rigid body physics in a realistic manner.
Error creating thumbnail: Unable to save thumbnail to destination
0.4.0
love.sound This module is responsible for decoding sound files.
love.system Provides access to information about the user's system.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.thread Allows you to work with threads.
Error creating thumbnail: Unable to save thumbnail to destination
0.7.0
love.timer Provides high-resolution timing functionality.
love.touch Provides an interface to touch-screen presses.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.video This module is responsible for decoding and streaming video files.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.window Provides an interface for the program's window.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0

Third-party modules

lua-enet Multiplayer networking module for games.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
socket Module for HTTP, TCP, and UDP networking.
Error creating thumbnail: Unable to save thumbnail to destination
0.5.0
utf8 Provides basic support for manipulating UTF-8 strings.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.2

Functions

love.getVersion Gets the current running version of LÖVE.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.1
love.hasDeprecationOutput Gets whether LÖVE displays warnings when using deprecated functionality.
Error creating thumbnail: Unable to save thumbnail to destination
11.0
love.setDeprecationOutput Sets whether LÖVE displays warnings when using deprecated functionality.
Error creating thumbnail: Unable to save thumbnail to destination
11.0

Types

Data The superclass of all data.
Object The superclass of all LÖVE types.
Variant The types supported by love.thread and love.event

Callbacks

General

Config Files Game configuration settings.
love.directorydropped Callback function triggered when a directory is dragged and dropped onto the window.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.draw Callback function used to draw on the screen every frame.
love.errhand The error handler, used to display error messages.
love.errorhandler The error handler, used to display error messages.
Error creating thumbnail: Unable to save thumbnail to destination
11.0
love.filedropped Callback function triggered when a file is dragged and dropped onto the window.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.focus Callback function triggered when window receives or loses focus.
Error creating thumbnail: Unable to save thumbnail to destination
0.7.0
love.keypressed Callback function triggered when a key is pressed.
love.keyreleased Callback function triggered when a keyboard key is released.
love.load This function is called exactly once at the beginning of the game.
love.lowmemory Callback function triggered when the system is running out of memory on mobile devices.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.mousefocus Callback function triggered when window receives or loses mouse focus.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.mousemoved Callback function triggered when the mouse is moved.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.2
love.mousepressed Callback function triggered when a mouse button is pressed.
love.mousereleased Callback function triggered when a mouse button is released.
love.quit Callback function triggered when the game is closed.
Error creating thumbnail: Unable to save thumbnail to destination
0.7.0
love.resize Called when the window is resized.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.run The main function, containing the main loop. A sensible default is used when left out.
love.textedited Called when the candidate text for an IME has changed.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.textinput Called when text has been entered by the user.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.threaderror Callback function triggered when a Thread encounters an error.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.touchmoved Callback function triggered when a touch press moves inside the touch screen.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.touchpressed Callback function triggered when the touch screen is touched.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.touchreleased Callback function triggered when the touch screen stops being touched.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0
love.update Callback function used to update the state of the game every frame.
love.visible Callback function triggered when window is shown or hidden.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.wheelmoved Callback function triggered when the mouse wheel is moved.
Error creating thumbnail: Unable to save thumbnail to destination
0.10.0

Joystick

love.gamepadaxis Called when a Joystick's virtual gamepad axis is moved.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.gamepadpressed Called when a Joystick's virtual gamepad button is pressed.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.gamepadreleased Called when a Joystick's virtual gamepad button is released.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.joystickadded Called when a Joystick is connected.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.joystickaxis Called when a joystick axis moves.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.joystickhat Called when a joystick hat direction changes.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0
love.joystickpressed Called when a joystick button is pressed.
love.joystickreleased Called when a joystick button is released.
love.joystickremoved Called when a Joystick is disconnected.
Error creating thumbnail: Unable to save thumbnail to destination
0.9.0


Other Languages