Hello forums!
I've been using Love2d for a little bit in order to create a prototype for a game. I'm trying to make a sprite loader, mostly based on the code on Build and Gun here: http://www.buildandgun.com/2014/07/anim ... ove2d.html
I've had to play around with my code and have probably messed up syntax somewhere, but the issue at the moment is that I keep getting an error about love.graphics.newImage expecting ImageData and receiving nil (it's receiving nil because I'm only trying to define the function, not use it at the moment).
I'll attach the Game file and the sprite loading file, maybe someone could help me out?
Thanks in advance, and I'm sorry if this has been asked about already. I've searched and come up empty, but I could've missed something.
Expected ImageData got nil
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 3
- Joined: Thu Dec 22, 2016 8:50 am
Re: Expected ImageData got nil
Reading the whole error message often helps, as it shows exact location where the error occurred. I assume it's in main file at line 74 where you use undefined (and therefore being a global, nil) variable.
-
- Prole
- Posts: 3
- Joined: Thu Dec 22, 2016 8:50 am
Re: Expected ImageData got nil
It's actually an error in sp on line 10-
Goes on to say:bad argument #1 to newImage (imageData expected got nil)
Code: Select all
Traceback
gamestate.lua:89: in function <gamestate.lua:88>
[C]: in function 'newImage'
sp/lua:10: in function 'spriteLoad'
sp.lua:33: in function 'updateFace'
sp.lua:43: in function 'update'
gamestate.lua:88: in function 'update'
[C]: in function 'xpcall'
Re: Expected ImageData got nil
Right, I didn't pay much attention; the are a bunch of globals in your code that you use in various functions, one functions messing it up for others may be the cause of the issue.
-
- Prole
- Posts: 3
- Joined: Thu Dec 22, 2016 8:50 am
Re: Expected ImageData got nil
Ahh, alright
I'll work that out, then
Thanks!
I'll work that out, then
Thanks!
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot] and 0 guests