Hello,
I start learning Lua and plan to make games with LÖVE. I want to code with Visual Studio Code.
I have installed and set up 'Code Runner' to launch lua53.exe (lua-5.3.5_Win64_bin) and vscode-lua for Intellisense and Linting.
I see two plugins for LOVE: LOVE by bschulte and Love2D Support by Pixelbyte Studios.
- Should I use another version of Lua?
- I have installed the first plugin. Would you recommand this one rather than the other one?
- And how can I make luacheck work with LÖVE?
Thank you!
Edit: Also installed Lua Debug, which can obviously be helpful
Using LÖVE with Visual Studio Code
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Using LÖVE with Visual Studio Code
You don't actually need Lua installed to run LÖVE games. LÖVE comes with everything you need, and by default it uses the LuaJIT interpreter, not Lua 5.3. Launching your LÖVE games in lua53.exe is not going to work; you need to run them with the LÖVE framework.
You can use an extension like Löve Launcher by Jan Werder to do so easily. The one by Pixelbyte Studios also supports launching the project in LÖVE (it is the one I use, I haven't used the one by bschulte).
luacheck and Lua Debug will work with LÖVE as well, but they're going to tell you that "love" is undefined, for example. Not sure if there's a way to fix that, so I just ignore it.
You can use an extension like Löve Launcher by Jan Werder to do so easily. The one by Pixelbyte Studios also supports launching the project in LÖVE (it is the one I use, I haven't used the one by bschulte).
luacheck and Lua Debug will work with LÖVE as well, but they're going to tell you that "love" is undefined, for example. Not sure if there's a way to fix that, so I just ignore it.
-
- Prole
- Posts: 14
- Joined: Fri Sep 16, 2016 5:21 am
Re: Using LÖVE with Visual Studio Code
Dont forget there is the Local Lua Debugger (tomblind.local-lua-debugger-vscode) extension.
This extension will debug love games with break points and all the cool stuff.
This extension will debug love games with break points and all the cool stuff.
Re: Using LÖVE with Visual Studio Code
Thanks to both of you! That was really helpful and I have now everything I need to learn and make games ![Smile :)](./images/smilies/ms-smile.png)
![Smile :)](./images/smilies/ms-smile.png)
Re: Using LÖVE with Visual Studio Code
Wow, I actually hadn't used this. It seems super useful, but doing require("lldebugger").start() is really resource intensive, it seems. My game drops to about 1 FPS. Also, on Windows, even though I use lovec.exe in the launch.json (and t.console is true, of course), the console window doesn't appear.scoobyff666 wrote: ↑Sun Apr 05, 2020 11:54 pm Dont forget there is the Local Lua Debugger (tomblind.local-lua-debugger-vscode) extension.
This extension will debug love games with break points and all the cool stuff.
Re: Using LÖVE with Visual Studio Code
I put that in user settings.json:
It sends "vsc_debug" as argument and I have this is the first line of my main.lua :
But the main point is that I had to put the configuration inside user settings. I don't remember why ![Embarrassed :oops:](./images/smilies/ms-shy.png)
Code: Select all
"launch": {
"configurations":
[
{
"type": "lua-local",
"request": "launch",
"name": "Debug LOVE",
"program":
{
"command": "love"
},
"args":
[
"${workspaceFolder}",
"vsc_debug"
],
},
]
},
Code: Select all
if arg[#arg] == "vsc_debug" then require("lldebugger").start() end
![Embarrassed :oops:](./images/smilies/ms-shy.png)
-
- Prole
- Posts: 14
- Joined: Fri Sep 16, 2016 5:21 am
Re: Using LÖVE with Visual Studio Code
Well, this may help some people. I put the following lines as the first lines in my main.lua:
So that this works if you're using vscode and also works for people who choose to use the zerobrane debugger.
Code: Select all
if pcall(require, "lldebugger") then require("lldebugger").start() end
if pcall(require, "mobdebug") then require("mobdebug").start() end
Yes it is really expensive. By running this code snippet above, you can still run your game by just running love on the terminal, as you would normally do without this vscode extension, and the debugger will not kick in, making the game perform normally. You can also add protection by a command line argument, like Nekyia suggested, so you can create a rule in vscode that will run without debugging. (I don't use windows so I cannot help about the terminal in windows part, sorry)Wow, I actually hadn't used this. It seems super useful, but doing require("lldebugger").start() is really resource intensive, it seems. My game drops to about 1 FPS. Also, on Windows, even though I use lovec.exe in the launch.json (and t.console is true, of course), the console window doesn't appear.
Re: Using LÖVE with Visual Studio Code
My love2d extension run 'love --console .' Is this similar to lovec.exe ?
I tried lovec.exe and can't see any difference.
I tried lovec.exe and can't see any difference.
Re: Using LÖVE with Visual Studio Code
I don't have Windows, so I can't tell for sure, but I believe lovec.exe is a "console application", meaning it's the OS who creates and attaches the console, while with love --console, it's Löve itself the one creating and attaching the console. I remember an old thread where the latter caused problems with some editor (Sublime?); maybe it's not the case for VSC or maybe that issue is fixed in a newer version.
-
- Prole
- Posts: 1
- Joined: Thu Jul 16, 2020 3:19 pm
Re: Using LÖVE with Visual Studio Code
Hi everyone,
I'm new to coding and just trying to get set up with a Lua/LOVE2D debugger in VS Code on a MacBook Pro. I don't understand anything about JSON, executables, etc. and just want to get Lua Love Debugger by Tom Blind up and running so that I can debug. Could someone please walk me through the steps I need to do to get set up. I'm currently using Love2D Support by Pixelbyte Studios to run the programs, but it doesn't appear to have a debugger for Mac.
Thanks!
I'm new to coding and just trying to get set up with a Lua/LOVE2D debugger in VS Code on a MacBook Pro. I don't understand anything about JSON, executables, etc. and just want to get Lua Love Debugger by Tom Blind up and running so that I can debug. Could someone please walk me through the steps I need to do to get set up. I'm currently using Love2D Support by Pixelbyte Studios to run the programs, but it doesn't appear to have a debugger for Mac.
Thanks!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests