love

The root module which contains all the other modules. Clearly the loveliest module of all.

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, simply by specifying their fully qualified name:

function love.load()
   hamster = love.graphics.newImage("hamster.png")
   x = 50
   y = 50
end
function love.draw()
   love.graphics.draw(hamster, x, y)
end

Modules

love.audio Provides of audio interface for playback/recording sound.
love.data Provides functionality for creating and transforming data. Added since 11.0
love.event Manages events, like keypresses. Added since 0.6.0
love.filesystem Provides an interface to the user's filesystem.
love.font Allows you to work with fonts. Added since 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. Added since 0.5.0
love.keyboard Provides an interface to the user's keyboard.
love.math Provides system-independent mathematical functions. Added since 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. Added since 0.4.0
love.sound This module is responsible for decoding sound files.
love.system Provides access to information about the user's system. Added since 0.9.0
love.thread Allows you to work with threads. Added since 0.7.0
love.timer Provides high-resolution timing functionality.
love.touch Provides an interface to touch-screen presses. Added since 0.10.0
love.video This module is responsible for decoding and streaming video files. Added since 0.10.0
love.window Provides an interface for the program's window. Added since 0.9.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

Config Files Game configuration settings.
love.directorydropped Callback function triggered when a directory is dragged and dropped onto the window. Added since 0.10.0
love.displayrotated Called when the device display orientation changed. Added since 11.3
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. Added since 11.0
love.filedropped Callback function triggered when a file is dragged and dropped onto the window. Added since 0.10.0
love.focus Callback function triggered when window receives or loses focus. Added since 0.7.0
love.gamepadaxis Called when a Joystick's virtual gamepad axis is moved. Added since 0.9.0
love.gamepadpressed Called when a Joystick's virtual gamepad button is pressed. Added since 0.9.0
love.gamepadreleased Called when a Joystick's virtual gamepad button is released. Added since 0.9.0
love.joystickadded Called when a Joystick is connected. Added since 0.9.0
love.joystickaxis Called when a joystick axis moves. Added since 0.9.0
love.joystickhat Called when a joystick hat direction changes. Added since 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. Added since 0.9.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. Added since 0.10.0
love.mousefocus Callback function triggered when window receives or loses mouse focus. Added since 0.9.0
love.mousemoved Callback function triggered when the mouse is moved. Added since 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. Added since 0.7.0
love.resize Called when the window is resized. Added since 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. Added since 0.10.0
love.textinput Called when text has been entered by the user. Added since 0.9.0
love.threaderror Callback function triggered when a Thread encounters an error. Added since 0.9.0
love.touchmoved Callback function triggered when a touch press moves inside the touch screen. Added since 0.10.0
love.touchpressed Callback function triggered when the touch screen is touched. Added since 0.10.0
love.touchreleased Callback function triggered when the touch screen stops being touched. Added since 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. Added since 0.9.0
love.wheelmoved Callback function triggered when the mouse wheel is moved. Added since 0.10.0


Other Languages

Testing

Config FilesGame configuration settings.000
love.directorydroppedCallback function triggered when a directory is dragged and dropped onto the window.100
love.displayrotatedCalled when the device display orientation changed.113
love.drawCallback function used to draw on the screen every frame.000
love.errhandThe error handler, used to display error messages.000
love.errorhandlerThe error handler, used to display error messages.110
love.filedroppedCallback function triggered when a file is dragged and dropped onto the window.100
love.focusCallback function triggered when window receives or loses focus.070
love.gamepadaxisCalled when a Joystick's virtual gamepad axis is moved.090
love.gamepadpressedCalled when a Joystick's virtual gamepad button is pressed.090
love.gamepadreleasedCalled when a Joystick's virtual gamepad button is released.090
love.joystickaddedCalled when a Joystick is connected.090
love.joystickaxisCalled when a joystick axis moves.090
love.joystickhatCalled when a joystick hat direction changes.090
love.joystickpressedCalled when a joystick button is pressed.000
love.joystickreleasedCalled when a joystick button is released.000
love.joystickremovedCalled when a Joystick is disconnected.090
love.keypressedCallback function triggered when a key is pressed.000
love.keyreleasedCallback function triggered when a keyboard key is released.000
love.loadThis function is called exactly once at the beginning of the game.110
000
love.lowmemoryCallback function triggered when the system is running out of memory on mobile devices.100
love.mousefocusCallback function triggered when window receives or loses mouse focus.090
love.mousemovedCallback function triggered when the mouse is moved.092
100
love.mousepressedCallback function triggered when a mouse button is pressed.110
000
love.mousereleasedCallback function triggered when a mouse button is released.110
000
love.quitCallback function triggered when the game is closed.070
love.resizeCalled when the window is resized.090
love.runThe main function, containing the main loop. A sensible default is used when left out.000
love.texteditedCalled when the candidate text for an IME has changed.100
love.textinputCalled when text has been entered by the user.090
love.threaderrorCallback function triggered when a Thread encounters an error.090
love.touchmovedCallback function triggered when a touch press moves inside the touch screen.100
love.touchpressedCallback function triggered when the touch screen is touched.100
love.touchreleasedCallback function triggered when the touch screen stops being touched.100
love.updateCallback function used to update the state of the game every frame.000
love.visibleCallback function triggered when window is shown or hidden.090
love.wheelmovedCallback function triggered when the mouse wheel is moved.100