LÖVE2D-0.9.1 with LuaJIT-2.0.3: ´print()´ doesn't write to console

1.2k Views Asked by At

IMPORTANT NOTICE: I asked on the Love2D Forums. Turns out Version 0.9.1 already uses LuaJIT, so there is no need to swap any Lua51.dll to "enable" LuaJIT. So the problem is solved.


I am trying to print something in the load function, however nothing appears in my console window.

conf.lua:

function love.conf(t)
    t.modules.audio = true             -- Enable the audio module (boolean)
    t.modules.event = true             -- Enable the event module (boolean)
    t.modules.graphics = true          -- Enable the graphics module (boolean)
    t.modules.image = true             -- Enable the image module (boolean)
    t.modules.joystick = true          -- Enable the joystick module (boolean)
    t.modules.keyboard = true          -- Enable the keyboard module (boolean)
    t.modules.math = true              -- Enable the math module (boolean)
    t.modules.mouse = true             -- Enable the mouse module (boolean)
    t.modules.physics = true           -- Enable the physics module (boolean)
    t.modules.sound = true             -- Enable the sound module (boolean)
    t.modules.system = true            -- Enable the system module (boolean)
    t.modules.timer = true             -- Enable the timer module (boolean)
    t.modules.window = true            -- Enable the window module (boolean)
    t.modules.thread = true            -- Enable the thread module (boolean)
    t.console = true
    t.title = "Tutorial Game"
    t.version = "0.9.1"
    t.screen.fullscreen = false
    t.screen.vsync = true
    t.screen.height = 600
    t.screen.width = 800
    t.fsaa = 0 
end

main.lua:

function love.load()
    print("Hello world")
end

function love.draw()
end

function love.update(dt)
end

function love.focus(bool)
end

function love.keypressed(key, unicode)
end

function love.keyreleased(key, unicode)
end

function love.mousepressed(x, y, button)
end

function mousereleased(x, y, button)
end

function love.quit()
end

Console should show:

Hello world

But all I see is

 

I hope someone can help me resolve this problem.

P.S.: Running the print() command in Lua normally (without using Love2D) works. I ran the exact same (but version 0.8.0) with love2d-0.8.0 and the issue didn't occur. Guess I will report this as a bug... Of course, you are only able to use your own lua51.dll since this new version, maybe it has something to with incompatabilities of LuaJIT and Love2D-0.9.1

4

There are 4 best solutions below

1
On

If you are under Mac, you should run from command line like:

/Applications/love.app/Contents/MacOS/love <path to you dir or .love file>

If you are under Windows, you config:

t.console = true

should work.

0
On

in love2d 0.9.1 i think t.screen doesn't work but t.window does.

try put love.graphics.print("Hello world!") in the draw function.

https://love2d.org/wiki/love.graphics.print

0
On

I had the same problem.

My solution for this problem was,and i know this sounds silly, to either remove the line t.console = true from your love.conf(t), or change the value from true to false.

(i use the love2d version 0.9.2 for win64)

0
On

From version 0.9.1 on löve2d already uses LuaJIT