Download the latest version of LÖVE from the website, and install it. If you're on Windows and don't want to install LÖVE, you can also just download the zipped executables and extract them anywhere.
To find out which version of LÖVE is installed, run the following command:
Making a Game
To make a minimal game, create a folder anywhere, and open up your favorite text editor. Sublime Text is a pretty good one for all operating systems, and it has Lua support built in. Create a new file in the folder you just created, and name it
main.lua. Put the following code in the file, and save it.
love.graphics.print("Hello World", 400, 300)
LÖVE can load a game in two ways:
- From a folder that contains a main.lua file.
- From a .love file that has a main.lua file in the top-most directory level (aka root)
For creating .love files see Game Distribution.
Otherwise, the easiest way to run the game is to drag the folder onto either love.exe or a shortcut to love.exe. Remember to drag the folder containing
main.lua, and not
You can also launch the game from the command line:
"C:\Program Files\LOVE\love.exe" "C:\games\packagedgame.love"
You can create a shortcut to do this; simply make a shortcut to love.exe, right-click on it and select "Properties", and then put the command line you want in the "Target" box for the shortcut.
On Windows, there is a special command-line option which will attach a console to the window, allowing you to see the result of
t.console=true in conf.lua):
On Linux, you can use one of these command lines:
If you installed LÖVE system-wide, you can double click on .love files in your file manager as well.
Mac OS X
On Mac OS X, a folder or .love file can be dropped onto the love application bundle. On the Mac Terminal (command line), you can use love like this (assuming it's installed to the Applications directory):
However, the above method will not output printed text to the terminal window. To do that, you will need to execute the love binary inside the application bundle directly:
You can set up an alias in your Terminal session to call the binary when you use
love by adding an alias to your
Open the file with
You may have to run
first if the file does not yet exist.
Then paste in the following code and save the file:
Now you can call love from the command line like Linux and Windows:
- Tutorial:Callback_Functions will teach you the basic structure of a love game.
- Category:Tutorials are the next piece of reading
Tiếng Việt –