Requesting help: game crashing without any reason.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
SniX
Prole
Posts: 24
Joined: Mon Aug 26, 2013 10:18 am

Requesting help: game crashing without any reason.

Post 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/,
Attachments
Zombies!.zip
(564.72 KiB) Downloaded 98 times
User avatar
moikmellah
Prole
Posts: 12
Joined: Fri Jan 31, 2014 8:31 pm
Location: USA
Contact:

Re: Requesting help: game crashing without any reason.

Post 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.
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

Re: Requesting help: game crashing without any reason.

Post by DaedalusYoung »

Alternatively, since you're not doing anything special with the function, just do this:

Code: Select all

G_Print = love.graphics.print
SniX
Prole
Posts: 24
Joined: Mon Aug 26, 2013 10:18 am

Re: Requesting help: game crashing without any reason.

Post by SniX »

Oh sorry, i am a moron ^.^
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests