Page 1 of 1

Requesting help: game crashing without any reason.

Posted: Fri Mar 21, 2014 4:25 pm
by SniX
So i have been making this little game this week, every issue i've found i've been able to solve, except this:
The game file is too big to fit in to this post and it being reasonable, so i have included an attachment with game files, ty.
Virus Total, just for security.https://www.virustotal.com/lv/file/0235 ... 395418972/,

Re: Requesting help: game crashing without any reason.

Posted: Fri Mar 21, 2014 6:17 pm
by moikmellah
I'm getting the following error when running it:

Code: Select all

Error: main.lua:206: bad argument #2 to 'print' (number expected, got nil)
stack traceback:
	[C]: in function 'print'
	main.lua:206: in function 'G_Print'
	main.lua:99: in function 'draw'
	[string "boot.lua"]:410: in function <[string "boot.lua"]:373>
	[C]: in function 'xpcall'
In main.lua, your definition of G_Print() includes x and y arguments, but when you call it you aren't providing those values, so love.graphics.print() is throwing an error. Try this for your definition of G_Print():

Code: Select all

function G_Print(text, x, y)
  local myX = tonumber(x) or 0
  local myY = tonumber(y) or 0
  love.graphics.print(text, myX, myY)
end
That'll guarantee that if X or Y aren't valid numbers, it'll use a default of 0.

Re: Requesting help: game crashing without any reason.

Posted: Fri Mar 21, 2014 8:31 pm
by DaedalusYoung
Alternatively, since you're not doing anything special with the function, just do this:

Code: Select all

G_Print = love.graphics.print

Re: Requesting help: game crashing without any reason.

Posted: Sat Mar 22, 2014 8:23 pm
by SniX
Oh sorry, i am a moron ^.^