2

I have made a new folder to keep my coding files in and folders of Love2D. But since then whenever I press alt+l in my main.lua file in vs code, the file doesn't run in love app.

Below is the image of what happens when I press Alt+l in vs code.

But, when I try to drag and drop the folder of my game onto the love2D shortcut on my desktop, the game runs fine.

Why does this happen?

Here are the settings of my love2d support extension:

Extension Settings

I have tried reinstalling love, also tried to reinstall the extension, and installing any previous version of love.

I tried to open the project directly as a project too. as above

Pls, can someone help me at the earliest?

1
  • I am using not VS or LÖVE on MS-Windows. But i can imagine that the LÖVE Path is not working because of the space in \Program Files\ ? I would try and suggest a test folder without space(s) like: C:\love\love.exe Commented Sep 10, 2021 at 13:25

3 Answers 3

1

You provided . as the src directory in the support extension, which probably tries to launch PIYUSH_LOVE2D as the game (which does not contain a main.lua).

Either open the game directory directly as a project in VS Code or enter the path of the game in Src Dir.

EDIT: Alt+L while the main.lua is open works and uses the dir containing the main as the root. The correct path is only required if the main.lua is not open.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried opening the folder directly as a project but it didn't work. Take a look in the question again I have appended the results.
Ok, I installed both VS and love2d extension. Alt+L while in the main.lua should work even if it is not in the projects root dir. I edited my answer. Just to clarify, what happens if you press Alt+L? Does an error msg pop up?
0

I found something that can help you on the LÖVE 2D website. Take a look:

“Remember to drag the folder containing main.lua, and not main.lua itself”

I don't know much about VS Code but I think to solve your problem you could configure it to run the game folder in LOVE, instead of its main.

1 Comment

Yes, it works when I drag and drop the folder itself on love2d. But doesn't run with with Alt+L directly
0

I'm late to answering this but I hope it helps someone. It looks like you have Live Server extension installed, I believe that also has a key combo of ALT+L, which interferes with the Love2D extension.

Try removing Live Server, or change the key combo to something other than ALT+L for either of the extensions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.