Page 1 of 1

Command line parameters not working

Posted: Sun Aug 04, 2019 10:27 am
by PGUp

Code: Select all

function love.load(arg)
    for i,v in pairs(arg) do
		print(v)
	end
end
I ran the .love file with the following command:

Code: Select all

main.love test a b c
the output of the print function is not showing the argument i passed with the command line

Re: Command line parameters not working

Posted: Sun Aug 04, 2019 3:41 pm
by Konikoko
I tried the following command in my cmd:

Code: Select all

"C:\Program Files\LOVE\love.exe" "tester" a b
and it worked for me.

I put the main.lua in a folder called tester with the following code:

Code: Select all

function love.load(arg)
    for i,v in pairs(arg) do
		print(v)
	end
end

function love.update(dt)
end

function love.draw()
end
And I also wrote a conf.lua:

Code: Select all

function love.conf(t)
	t.console = true
end

Re: Command line parameters not working

Posted: Sun Aug 04, 2019 9:59 pm
by pgimeno
My guess: that calling the file, so that the executable to run is determined by extension, is not passing the additional parameters to said executable.

Try checking if there is any mechanism in your OS to solve that, or call the executable yourself as Konikoko suggests.

Re: Command line parameters not working

Posted: Tue Aug 06, 2019 7:08 am
by ketkipatil
Good explaination..