How to Setup Love2D with Visual Studio Code
Getting your setup ready for executing Lua code for Love2D game engine through Visual Studio Code editor
- Go to https://love2d.org/ and install Love2D for the operating system specific to your laptop or computer. For me it was Windows 64-bit installer.
2. Make sure you take a note of where the love.exe is being installed
When you click on love.exe you will see below image. That means love is installed properly, we see this image because we are not running any program right now.
3. In Visual Studio Code install, go to extensions (see 1 in the image) . Install Love2D Support extension. Go to the settings of Love2D Support extension (see 2 in the image) .
4. Select the settings and go to extension settings.
Make sure the path is correct. That means it matches the path where love.exe is present.
5. Create a new folder for our project. Create an empty file main.lua in it and write the below code to display text on the love console.
Press Alt+L to run the program. You should see the text that you entered displayed in love console. That means the setup is successful, you can code your games in lua for Love2D in VS Code editor.
This is it. Have fun building your games in Love2D.