Search found 3 matches

by Superviro
Thu Feb 25, 2021 12:26 am
Forum: Support and Development
Topic: Attempt to index local 'self' (a number value)
Replies: 10
Views: 8667

Re: Attempt to index local 'self' (a number value)

I'm a dope.

The error came from another file where I was calling Score.udpate(1) instead of Score:update(1). I knew it, but I overlooked it.
by Superviro
Wed Feb 24, 2021 8:40 pm
Forum: Support and Development
Topic: Attempt to index local 'self' (a number value)
Replies: 10
Views: 8667

Re: Attempt to index local 'self' (a number value)

This is a mix up between the dot (.) and colon (:) syntax. Consider the following: function Score.load(self) self.score = 0 end Score.load(Score) -- is syntactically equivalent to function Score:load() self.score = 0 end Score:load() When you use the colon syntax, you are implicitly sending the tab...
by Superviro
Wed Feb 24, 2021 4:45 am
Forum: Support and Development
Topic: Attempt to index local 'self' (a number value)
Replies: 10
Views: 8667

Attempt to index local 'self' (a number value)

I'm beating my head against the wall on this one. require 'libraries.fonts' Score = {} function Score:load() self.score = 0 end function Score:update(amount) self.score = self.score + amount -- Line of code throwing error end function Score:draw() love.graphics.setFont(Fonts.dotGothic20) love.graphi...