What exactly is the nil value?

In my game, everything works fine until the main character dies at the end. I’m using a sprite sheet for the main character and when the last hit that causes him to die makes the game crash. It says "attempt to call method ‘prepare’ (a nil value). I’m using storyboard so it changes scenes at the end of the game, so I know it clears up everything. My question is what exactly is the nil value that it is referring to?

[lua]guy.healthy = false
updateDamageBar(params)
guy:prepare(“hurt”)
guy:play()[/lua]

This is the function where it happens. The updateDamageBar method is where it eventually changes scenes at the end of the game. I tried checking to see if ‘guy’ was nil but that did not work either. Any suggestions, hints, or advice?

Thanks.

Have you tried commenting out the "guy:prepare(“hurt”) line and see what happens?

Nil Nil means zero value, but I have received this error quite a bit and the first thing I do is comment out the line, see what happens, then it’s usually something wrong with the corresponding function.

Maybe it’s referring to the guy object?  Is this being nil’ed out before the prepare(“hurt”) line somehow?

You are trying to call guy:prepare() before guy exists or after guy has been removed (or written over with something besides a sprite)

Have you tried commenting out the "guy:prepare(“hurt”) line and see what happens?

Nil Nil means zero value, but I have received this error quite a bit and the first thing I do is comment out the line, see what happens, then it’s usually something wrong with the corresponding function.

Maybe it’s referring to the guy object?  Is this being nil’ed out before the prepare(“hurt”) line somehow?

You are trying to call guy:prepare() before guy exists or after guy has been removed (or written over with something besides a sprite)