LÖVE2D-0.9.1与LuaJIT-2.0.3:'print()'不写入控制台

时间:2014-11-29 20:56:48

标签: lua luajit love2d

重要通知: 我问过Love2D论坛。事实证明版本0.9.1已经使用了LuaJIT,因此不需要将任何Lua51.dll交换为"启用" LuaJIT。所以问题就解决了。


我正在尝试在加载函数中打印一些内容,但是我的控制台窗口中没有任何内容。

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

控制台应显示:

Hello world

但我所看到的只是

 

我希望有人可以帮我解决这个问题。

P.S。:通常在Lua中运行print()命令(不使用Love2D)。 我使用love2d-0.8.0运行完全相同(但版本0.8.0)并且问题没有发生。 猜猜我会报告这是一个错误...... 当然,从这个新版本开始,你只能使用自己的lua51.dll,也许它与LuaJIT和Love2D-0.9.1的不兼容性有关。

4 个答案:

答案 0 :(得分:1)

如果你在Mac下,你应该从命令行运行,如:

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

如果您在Windows下,则配置:

  

t.console = true

应该有用。

答案 1 :(得分:0)

in love2d 0.9.1 我觉得t.screen不起作用,但t.window会这样做。

尝试将love.graphics.print("Hello world!")放入绘图功能。

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

答案 2 :(得分:0)

löve2d上的版本0.9.1已经使用了LuaJIT

答案 3 :(得分:0)

我遇到了同样的问题。

我对此问题的解决方案是,并且我知道这听起来很愚蠢,要么从t.console = true删除行love.conf(t),要么将值从true更改为false }。

(我使用love2d版本0.9.2 for win64)