Search found 4 matches

by ETShift
Thu Apr 28, 2016 5:46 pm
Forum: Support and Development
Topic: attempt to perform arithmitic on field 'mousex'(a nil value)
Replies: 6
Views: 2581

Re: attempt to perform arithmitic on field 'mousex'(a nil value)

s-ol wrote:the issue is that you are doing Player:updateAim() when you want to be doing self:updateAim in Player:updateMouse. Otherwise in Player:updateAim, self refers to 'Player' which is your Class, not your Object so the .mousex and .mousey aren't set there.
Ah, thanks. It works now. Or rather, for now.
by ETShift
Thu Apr 28, 2016 5:42 pm
Forum: Support and Development
Topic: attempt to perform arithmitic on field 'mousex'(a nil value)
Replies: 6
Views: 2581

Re: attempt to perform arithmitic on field 'mousex'(a nil value)

The Visibility Rules section of the reference manual explains lexical scope in Lua. Function parameters act as local variables; they are block-scoped (see Function Definitions ). I'm not doing anything with the updateMouse's mousex and mousey, I'm trying to access self.mousex and self.mousey, which...
by ETShift
Wed Apr 27, 2016 11:12 pm
Forum: Support and Development
Topic: attempt to perform arithmitic on field 'mousex'(a nil value)
Replies: 6
Views: 2581

Re: attempt to perform arithmitic on field 'mousex'(a nil value)

But the function just above (That was already there) worked fine: function Player:updateMouse(mousex, mousey) -- That works self.mousex = mousex self.mousey = mousey Player:updateAim() end function Player:updateAim() -- But this has issues --debug.debug() self.aimdistance = ((self.mousex-self.x)^2+(...
by ETShift
Tue Apr 26, 2016 3:56 pm
Forum: Support and Development
Topic: attempt to perform arithmitic on field 'mousex'(a nil value)
Replies: 6
Views: 2581

attempt to perform arithmitic on field 'mousex'(a nil value)

I got the code for this game to look and help me build a bullet hell. Unfortunately it was for an old version, so I fixed it in a few places. Then I decided that my code stinks and that I was just going to modify that one instead. Anyway in the section that's failing I'm trying to get it to get the ...