How can I troubleshoot this error?

Hi, I am having trouble troubleshooting this error as it doesn’t give me an actual function or line number… Am I missing something??

ERROR:

?:0: attempt to perform arithmetic on field ‘?’ (a table value) stack traceback:
[C]:?
?: in function <?:172>
?: in function <?:218>
 

PS:  I don’t have line# 172 or 218 on any of my files…

Could be your passing something wrong to a widget, storyboard or plugin

The error says that you are passing a table somewhere that’s expecting a number.  This could simply be as simple as passing a table where a number is expected, not having the right number of parameters or using a . when calling a function that’s expected to be called with a : or visa versa.

Without seeing your code, it’s going to be hard to speculate on where.  When you see the ? as the module name, it’s in core code, which means its where you’re calling one of our functions, not one of your own.  Your app is also likely crashing at this point, so if somethings are not drawing right or a button triggers it, that can help you narrow down where to look.  Adding in some print statements to see where its getting too is a useful way of tracking this down.

Thanks for the answers!  I found the offending line, but I’m not sure what is wrong with it…

I have a firing mechanism that creates a new instance of ‘Bullet’ and then calls the Bullet:move function, the line causing the error has been commented out below.

function Bullet:move(targetX, targetY, time) local targetX = targetX local targetY = targetY print ("Moving bullet") print("PRINTING BULLET!!!!!!!!!!!!") for key,value in pairs(self.\_visual) do print(key,value) end print ("X: "..self.\_visual.x .. "Y: "..self.\_visual.y) --self.\_visual.transition = transition.to(self.\_visual, { time=200, x=targetX, y=targetY}) print("MOVED BULLET") end

what is self._visual?

It’s the display part of my Bullet object…

 

 self.\_visual = display.newImage( parentGroup, "Images/bullet.png") self.\_visual.height=32 self.\_visual.width=32 -- Create the physics self.\_bulletCollisionFilter = { categoryBits = 8, maskBits = 4 } physics.addBody( self.\_visual, "kinematic", {filter=self.\_bulletCollisionFilter } ) self.\_visual.isSensor = true self.\_visual.type = "bullet" self.\_visual.owner = self self.\_visual.y = params.spawnY self.\_visual.x = params.spawnX

Can you printout targetX and targetY and make sure they are what you’re expecting them to be?

Could be your passing something wrong to a widget, storyboard or plugin

The error says that you are passing a table somewhere that’s expecting a number.  This could simply be as simple as passing a table where a number is expected, not having the right number of parameters or using a . when calling a function that’s expected to be called with a : or visa versa.

Without seeing your code, it’s going to be hard to speculate on where.  When you see the ? as the module name, it’s in core code, which means its where you’re calling one of our functions, not one of your own.  Your app is also likely crashing at this point, so if somethings are not drawing right or a button triggers it, that can help you narrow down where to look.  Adding in some print statements to see where its getting too is a useful way of tracking this down.

Thanks for the answers!  I found the offending line, but I’m not sure what is wrong with it…

I have a firing mechanism that creates a new instance of ‘Bullet’ and then calls the Bullet:move function, the line causing the error has been commented out below.

function Bullet:move(targetX, targetY, time) local targetX = targetX local targetY = targetY print ("Moving bullet") print("PRINTING BULLET!!!!!!!!!!!!") for key,value in pairs(self.\_visual) do print(key,value) end print ("X: "..self.\_visual.x .. "Y: "..self.\_visual.y) --self.\_visual.transition = transition.to(self.\_visual, { time=200, x=targetX, y=targetY}) print("MOVED BULLET") end

what is self._visual?

It’s the display part of my Bullet object…

 

 self.\_visual = display.newImage( parentGroup, "Images/bullet.png") self.\_visual.height=32 self.\_visual.width=32 -- Create the physics self.\_bulletCollisionFilter = { categoryBits = 8, maskBits = 4 } physics.addBody( self.\_visual, "kinematic", {filter=self.\_bulletCollisionFilter } ) self.\_visual.isSensor = true self.\_visual.type = "bullet" self.\_visual.owner = self self.\_visual.y = params.spawnY self.\_visual.x = params.spawnX

Can you printout targetX and targetY and make sure they are what you’re expecting them to be?