Running love2d programs with intellij idea [closed]

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
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

Running love2d programs with intellij idea [closed]

Post by bobbymcbobface »

hi all,

i need some help running love2d programs in intellij

here's what i have so far ~
a.PNG
a.PNG (16.86 KiB) Viewed 3697 times
but when i try and run it this happens ~
b.PNG
b.PNG (69.27 KiB) Viewed 3697 times
any help will be largely appreciated ~ thanks

(yes i think I've posted this topic before but it was in the wrong place and wasn't explained well)
Last edited by bobbymcbobface on Sun Dec 08, 2019 1:16 pm, edited 1 time in total.
I make games that run on potatoes :P
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Running love2d programs with intellij idea

Post by raidho36 »

You must pass game directory as an argument, setting working directory does nothing.
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Running love2d programs with intellij idea

Post by pgimeno »

Setting working directory allows you to use a dot "." as parameter.
User avatar
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

Re: Running love2d programs with intellij idea

Post by bobbymcbobface »

ok so i kinda got it working but an error raised concerning my code ~

Code: Select all

"\"C:\Program Files\LOVE\love.exe\" \"C:\path\Documents\Love2-Lua projects\Snake\""
Error: Menu.lua:292: bad argument #2 to 'printf' (number expected, got nil)
stack traceback:
	[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
	[C]: in function 'printf'
	Menu.lua:292: in function 'draw'
	main.lua:19: in function 'draw'
	[string "boot.lua"]:618: in function <[string "boot.lua"]:594>
	[C]: in function 'xpcall'
and it raises the error specifically on this line

Code: Select all

love.graphics.printf("Begin", A1, 10, 200)
but this was working perfectly fine before my run configuration glitched out, here's my run config:

Program:"C:\Program Files\LOVE\love.exe" "C:\path\Documents\Love2-Lua projects\Snake"
Working Dir: .

referring to a post found here: https://love2d.org/forums/viewtopic.php?t=82515

and quoting zorg
I personally use a file called "run.bat", that's in all my folders, with the path to the executable in it, and it runs main.lua. simple.
For example:
"e:\Portable Programs\love-0.10.1-win64\love.exe" .\
would that be an easier way of doing things instead of using a run config and if so how would i achieve this?
and if not then what is wrong with my config? :P

~thanks
I make games that run on potatoes :P
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Running love2d programs with intellij idea

Post by raidho36 »

Well this has clearly nothing to do with your config because your argument #2 (A1) is nil, as appears in Menu.lua @ line 292. Pay attention to error messages, they tell you exactly what went wrong. You can make error messages point to specific mistakes in your code by adopting defensive programming practices.
User avatar
bobbymcbobface
Citizen
Posts: 78
Joined: Tue Jun 04, 2019 8:31 pm

Re: Running love2d programs with intellij idea

Post by bobbymcbobface »

Oh I'm an idiot ~ after a quick scan I realise that menu.load() wasn't being called so it was detecting A1 as a nill value

Well anyways thanks for the help and hopefully I'll get better at debugging soon

~ Thanks :)
I make games that run on potatoes :P
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 125 guests