expected number, got nil

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
User avatar
Djent
Prole
Posts: 27
Joined: Sun Jan 20, 2013 3:22 pm
Location: Rhode Island

expected number, got nil

Post 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.
Attachments
food.lua
(3.16 KiB) Downloaded 114 times
main.lua
(879 Bytes) Downloaded 96 times
4th Gen 30.love
(1.67 KiB) Downloaded 110 times
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: expected number, got nil

Post by Ranguna259 »

agents.lua not here
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
Djent
Prole
Posts: 27
Joined: Sun Jan 20, 2013 3:22 pm
Location: Rhode Island

Re: expected number, got nil

Post 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.
User avatar
Chroteus
Citizen
Posts: 89
Joined: Wed Mar 20, 2013 7:30 pm

Re: expected number, got nil

Post 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.
User avatar
Djent
Prole
Posts: 27
Joined: Sun Jan 20, 2013 3:22 pm
Location: Rhode Island

Re: expected number, got nil

Post 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.
Attachments
4th Gen 31 all 4 files.love
(2.71 KiB) Downloaded 100 times
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: expected number, got nil

Post 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

Code: Select all

	yposition = ypos,
is incorrect. The correct line is this (with a capital P)

Code: Select all

	yposition = yPos,
User avatar
Djent
Prole
Posts: 27
Joined: Sun Jan 20, 2013 3:22 pm
Location: Rhode Island

Re: expected number, got nil

Post 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

Code: Select all

	yposition = ypos,
is incorrect. The correct line is this (with a capital P)

Code: Select all

	yposition = yPos,
Wow, thanks. The SciTE editor font makes 'p' and 'P' look almost exactly the same.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: expected number, got nil

Post by Ranguna259 »

I recommend notepad++ for programming editing, you can select multiple locations to type among other features, it's only for windows though
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 5 guests