Error on Windows, not on Mac
Posted: Tue Jul 28, 2015 12:43 am
Hello,
In my game, on Windows, if I double click on an object (a token) the game crashes and says:
However, if I do the same thing on the Mac version, which is compiled from the same code, this does not happen.
Here is the code, the lines (809 & 819) are indicated by comments:
I don't really know what is happening... please, help me.
Thank you in advance.
In my game, on Windows, if I double click on an object (a token) the game crashes and says:
Code: Select all
Error
main.lua:819: attempt to index a nil value
Traceback
main.lua:819: in function <main.lua:809>
[C]: in function 'xpcall'
Here is the code, the lines (809 & 819) are indicated by comments:
Code: Select all
function love.mousepressed(x, y, b)
if global.inGame then
if b == "l" then
if not timers.toMenu and boxHit(x, y, button.back.x * settings.scale, button.back.y * settings.scale, button.back.width * settings.scale, button.back.height * settings.scale) then
button.back.isDown = true
end
if boxHit(x, y, button.again.x * settings.scale, button.again.y * settings.scale, button.again.width * settings.scale, button.again.height * settings.scale) then
button.again.isDown = true
end
end
elseif global.inCredits then
if b == "l" then
if not timers.toMenu and boxHit(x, y, button.back.x * settings.scale, button.back.y * settings.scale, button.back.width * settings.scale, button.back.height * settings.scale) then
button.back.isDown = true
end
end
else
if b == "l" then -- LINE 809 !!!
if not timers.toGame and boxHit(x, y, button.play.x * settings.scale, button.play.y * settings.scale, button.play.width * settings.scale, button.play.height * settings.scale) then
button.play.isDown = true
end
if not timers.toCredits and boxHit(x, y, button.info.x * settings.scale, button.info.y * settings.scale, button.info.width * settings.scale, button.info.height * settings.scale) then
button.info.isDown = true
end
if not timers.exit and boxHit(x, y, button.exit.x * settings.scale, button.exit.y * settings.scale, button.exit.width * settings.scale, button.exit.height * settings.scale) then
button.exit.isDown = true -- LINE 819 !!!
end
end
end
end
Thank you in advance.