Page 1 of 1

mousepressed and print

Posted: Sat Aug 27, 2016 7:35 pm
by Firus
well, it sounds idiot, but i have this problem here in my main.lua file:

Code: Select all

function love.mousepressed(x, y, button, istouch)
	print( x .. " " .. y)
end

function love.draw()
	love.graphics.print("Hello", 100, 200)
end
I'm using love 0.10 and Lua 5.3, on Windows 10...
the print isn't working, i belived that the love.mousepressed() is not be triggered. Thanks for help!

Re: mousepressed and print

Posted: Sat Aug 27, 2016 7:45 pm
by rok
Works great on 0.10.1 on Linux.

Did you run the game via the console to see the output?

Re: mousepressed and print

Posted: Sat Aug 27, 2016 7:45 pm
by zorg
First thing's first, the fact that you might have Lua 5.3 on your OS does not change the fact that by default, löve uses luaJIT.

As for your issue, since print prints to the console, did you enable it in conf.lua?
Because without that, it won't work.

If it still doesn't work, then it's either because you're using an IDE like zerobrane, or you're trying to run your project from a text editor like sublimetext, that swallow the console output. Or it might be a win10 issue; solutions to that will come with the next version.

Re: mousepressed and print

Posted: Sat Aug 27, 2016 7:46 pm
by raidho36
I believe "print" is supposed to print to console, so if you don't have one opened nothing will happen.

Re: mousepressed and print

Posted: Sat Aug 27, 2016 8:05 pm
by Firus
I'm running at the prompt and nothing is show on the console. Conf.lua doesn't help...

Re: mousepressed and print

Posted: Sat Aug 27, 2016 8:12 pm
by raidho36
Not sure I know what's going on. As an intermediate solution, you can define "print" to output information directly on the game screen as an overlay.

Re: mousepressed and print

Posted: Sat Aug 27, 2016 8:17 pm
by Firus
Ops, my bad. i'm worng... Zorg is right i had to add

Code: Select all

function love.conf(t)
	t.console = true
end
and it's worked proprely... Thanks again.