I'm using Goature's tutorial for the base of my game and it keeps on saying enttities/box.lua:23: attempt to index 'self' (a nil value).
I don't know how to fix it can i plz have help.
'self' (a nil value)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Sun Jun 19, 2016 11:47 am
'self' (a nil value)
- Attachments
-
- entities.lua
- (923 Bytes) Downloaded 113 times
Re: 'self' (a nil value)
Please follow the guidelines. Make a .love file containing all of your code and assets and upload it, or we may not be able to help.
In this case, you probably used "." instrad of ":" when calling a function or vice versa.
In this case, you probably used "." instrad of ":" when calling a function or vice versa.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- DanielPower
- Citizen
- Posts: 50
- Joined: Wed Apr 29, 2015 5:28 pm
Re: 'self' (a nil value)
I'm assuming your issue lies either here:
or here:
You're mixing up '.' and ':' on the ent.update call. But without the .love file, I can't help any more than that.
Code: Select all
if ent.update then
ent:update(dt)
end
Code: Select all
if ent.draw then
ent.draw()
end
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: 'self' (a nil value)
Technically, he's not, since he's checking if the field exists or not, and even if it's a function that would require a self parameter to be passed first (that : would pass implicitly when called),DanielPower wrote:You're mixing up '.' and ':' on the ent.update call. But without the .love file, I can't help any more than that.
Code: Select all
if table:field then
That said, the error might be that he's mixing up the . and or : when one of the calls actually happen. (either update should be with a ".", or draw with a ":")
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Prole
- Posts: 2
- Joined: Sun Jun 19, 2016 11:47 am
Re: 'self' (a nil value)
I posted the wrong file here's the right one.
- Attachments
-
- Unidentified .love
- (274.21 KiB) Downloaded 104 times
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests