Page 1 of 1
expected number, got nil
Posted: Fri Sep 13, 2013 4:44 pm
by Djent
I'm making a simple simulation, rewriting an old version because mainly my old code was junk even though it worked. Right now, I've just programmed food splotches to appear on the ground.
My problem is that love.draw() seems to get called in the middle of making the x and y coordinates for the splotches, resulting in the x coordinate being created, but not the y. Again, I'm not exactly sure that is what's happening, but it's the only way I can seem to explain it.
Here's the .love and main.lua and food.lua. Right click to crash and see the error message.
Re: expected number, got nil
Posted: Fri Sep 13, 2013 5:23 pm
by Ranguna259
agents.lua not here
Re: expected number, got nil
Posted: Fri Sep 13, 2013 5:45 pm
by Djent
Ranguna259 wrote:agents.lua not here
Neither is path.lua, but that doesn't really matter. No functions are called from agents or path. LOVE didn't throw me any errors about missing either of those files, but you could just create two empty files of the same name if you wanted to try that.
Re: expected number, got nil
Posted: Fri Sep 13, 2013 6:00 pm
by Chroteus
You HAVE to have a lua file if you're going to require it. Even if you won't use it's functions.
Re: expected number, got nil
Posted: Fri Sep 13, 2013 6:31 pm
by Djent
Chroteus wrote:You HAVE to have a lua file if you're going to require it. Even if you won't use it's functions.
Well I added the lua files for you guys, and it still doesn't work, so if we could get back to the original problem, that would be great.
Re: expected number, got nil
Posted: Fri Sep 13, 2013 6:57 pm
by micha
First off all, the other guys asked for the missing .lua files, because they are needed to reproduce your error.
And here is your solution:
You made a typo in line 44 in food.lua
is incorrect. The correct line is this (with a capital P)
Re: expected number, got nil
Posted: Fri Sep 13, 2013 7:15 pm
by Djent
micha wrote:First off all, the other guys asked for the missing .lua files, because they are needed to reproduce your error.
And here is your solution:
You made a typo in line 44 in food.lua
is incorrect. The correct line is this (with a capital P)
Wow, thanks. The SciTE editor font makes 'p' and 'P' look almost exactly the same.
Re: expected number, got nil
Posted: Fri Sep 13, 2013 7:26 pm
by Ranguna259
I recommend notepad++ for programming editing, you can select multiple locations to type among other features, it's only for windows though