Difficulty with Command Paths

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
LordEd5533
Prole
Posts: 5
Joined: Sat Jan 27, 2018 1:35 pm

Difficulty with Command Paths

Post by LordEd5533 »

I have downloaded Lua and Love2D, but have come across some confusion with command paths. When I type the command, love in Command Prompt, this shows which means I have Love set as my variable path.
Image

I already have a folder named Test with the main.lua file inside, containing the simple "Hello World" code.
Image

When I want to run the main.lua code from my Command Prompt, it shows the first image above. In my prompt, I am putting in \dev\test\main.lua. Main.lua still runs when I drag and drop the folder onto Love, but my question is, does it really matter to have a command path? Can I still run my code by dragging and dropping the folder? Also, If there is anyway to resolve this, please let me know.
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Difficulty with Command Paths

Post by zorg »

You mean you have "whatever\path\to\love.exe" included in your PATH variable, hopefully; replacing PATH with just that one would break tons of other things.

It's not important if you only want to open your projects by drag/dropping them onto either love.exe, or a shortcut of it.

On the other hand, depending on what's the current working directory in your commad prompt (C:\Users\lorde in your case, from the image), you need to either put an absolute path to your project folder, or a relative one from the CWD.

Thankfully you also showed where the project is, so i can type out both paths for you:

C:\Users\lorde> love "C:\Dev\Test"
or
C:\Users\lorde> love "..\..\Dev\Test"



As for your other question, it's not really important for löve to be in the PATH variable, although it does enable you to run löve from any CWD in the command prompt; otherwise, you'd need to give the full path to it, or a relative one, from the CWD, as before:

C:\Users\lorde> "C:\Dev\love-0.10.2-win64\love.exe" "C:\Dev\Test"
or
C:\Users\lorde> "..\..\Dev\love-0.10.2-win64\love.exe" "..\..\Dev\Test"
or you can mix and match these up.

It's usually faster to have something like a file called run.bat, and put the absolutes version in it (or any, if you don't want to move either your project dir or your löve installation), and use that to run your project.



One more thing, löve already comes with its own lua interpreter (well, it comes with luaJIT), point is, you don't need the separate lua installation for löve to work.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
LordEd5533
Prole
Posts: 5
Joined: Sat Jan 27, 2018 1:35 pm

Re: Difficulty with Command Paths

Post by LordEd5533 »

Oh, I see. So I can uninstall Lua and another thing, Is it crucial to use Command Prompt at all? I find it easier just to work with my IDE and dragging and dropping my project onto Love. Using the Command Prompt to me is just useless and waste of time.
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Difficulty with Command Paths

Post by zorg »

You don't need to use the command prompt at all.

Well, one thing though, if you do want to print stuff to a console window, then löve will open its own (you may need to use lovec.exe instead of love.exe though), so you can see the result of print statements and the like; that's also not necessary, but it may make debugging easier.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
LordEd5533
Prole
Posts: 5
Joined: Sat Jan 27, 2018 1:35 pm

Re: Difficulty with Command Paths

Post by LordEd5533 »

I use ZeroBrane. Is debugging on ZeroBrane easy? Sorry if I ask these noob questions, I am new to all this.
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Difficulty with Command Paths

Post by zorg »

I'll let someone else answer that, i don't use ZeroBrane myself so i wouldn't know! :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
pgimeno
Party member
Posts: 3688
Joined: Sun Oct 18, 2015 2:58 pm

Re: Difficulty with Command Paths

Post by pgimeno »

Once set up, it's a breeze. Setting it up the first time may take some work, see docs.

The only problem is that it significantly slows down your program, to a point where it can possibly behave differently. I've had that happen, pursuing a bug that did not actually exist. But that probably applies to programs that are heavy in calculations only.
User avatar
jojomickymack
Prole
Posts: 45
Joined: Tue Dec 26, 2017 4:52 pm

Re: Difficulty with Command Paths

Post by jojomickymack »

Zerobrane's love2d debugging is really great, if you want to use it you just add

if arg[#arg] == "-debug" then require("mobdebug").start() end

at the top of function love.load()

here's more information about that feature.
http://notebook.kulchenko.com/zerobrane ... -debugging

If you ever need to dump a table to the console, try this library.

https://github.com/kikito/inspect.lua

It really helps a lot with debugging and really helps demystify what's going on in the program.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 6 guests