Attemted to index local 'self' (a nil value)


I’m new to LUA but have programmed in other languages before (such as Java and PHP). I’m having trouble trying to get the Katana working. I already updated some of the weapons to work with the latest GMod update but the Katana is giving me problems.
I’m getting the error “attempt to index local ‘self’ (a nil value)”. I’ve looked at other weapons and they seem to be able to use this method fine. Here’s my code (error is coming from line 207) .

Would be much appreciated if you guys could help me on this one!


EDIT: Here’s a screenshot of the error too if it helps

Try with replacing line 201 with this:

[lua]timer.Simple(0.15, function() self:Slash() end)[/lua]

And line 193 with this:

[lua]timer.Simple(0.10, function() self:Bash() end)[/lua]

The error originates from your call to the SWEP:Slash() function.

[lua]timer.Simple(0.15,self.Slash, self)[/lua]

The syntax of timer has changed.

what you want is:
[lua]timer.Simple(0.15, function()self:Slash() end)[/lua]

Thanks to both of you! It works now! Thanks again!