Getting this error but I have no idea why

errorMessage: ?:0: attempt to perform arithmetic on field 'width' (a nil value) stackTrace: stack traceback: ?: in function \<?:160\> (tail call): ? /Users/jenkins/slaveroot/workspace/Templates/label/android/subrepos/transition/transition.lua:588: in function 'method' /Users/jenkins/slaveroot/workspace/Templates/label/android/platform/resourc

So I’m seeing a lot of these come through in flurry and I really have no idea why. It seems like a nil value is passed to the transition is what I gathered. 

I have 1 transition in my whole app that uses a width and the width can never be nil because I hard code a value into it. Does anyone have any idea what could be causing this?

I would assume that the transition is not being passed the table which contains the .width value. Or your .width is not actually set as you think it is. Can you post your code? (keep it minimal)

Post some sample code so we can see the issue. Posting just ther error is to little info.

Larry

transition.to( event.target, { time=250, width=0 })

This is the only place I’m setting a width in a transition. I’ve tried setting it to .01 as well incase the 0 was the issue but same errors show up.

Is this happening in a collision event listener?

Can you post the function which contains the transition?

@DMGLakewook

this is an exampl on how I am using the transition.

transition.to( image, { time=500, alpha=0, x=(swipeToX), y=(swipeToY) } )

(horacebury) makes a great point!!

if you are doing this in a Collosion lisitner you CANT act upon an object at the time of a collision. ( but you need to ) the work around for that is to wrap it in a timer.

local function listener( event )
  transition.to( event.target, { time=250, width=0 })
end

timer.performWithDelay( 1000, listener )

or

timer.performWithDelay( 1000, transition.to( event.target, { time=250, width=0 } ))

This causes a 1 millisecond delay and allows the cpu to complete the collision of the object and fire your transisition.

Hopefully this was your issue - if not, then your question is to generic and your going to need to paste in a block of code that we can review for you.

Lary

It is not in a collision event. I’m simply flipping a card over by scrolling the width to 0 and then swapping the card then on the new object setting the width back to the original size using a hard coded value for both.

chances are “event.target” is not a display obj or is simply null, do a simple test to check wether it exists

print( event.target and "exists" or "doesn't exist" )

I would assume that the transition is not being passed the table which contains the .width value. Or your .width is not actually set as you think it is. Can you post your code? (keep it minimal)

Post some sample code so we can see the issue. Posting just ther error is to little info.

Larry

transition.to( event.target, { time=250, width=0 })

This is the only place I’m setting a width in a transition. I’ve tried setting it to .01 as well incase the 0 was the issue but same errors show up.

Is this happening in a collision event listener?

Can you post the function which contains the transition?

@DMGLakewook

this is an exampl on how I am using the transition.

transition.to( image, { time=500, alpha=0, x=(swipeToX), y=(swipeToY) } )

(horacebury) makes a great point!!

if you are doing this in a Collosion lisitner you CANT act upon an object at the time of a collision. ( but you need to ) the work around for that is to wrap it in a timer.

local function listener( event )
  transition.to( event.target, { time=250, width=0 })
end

timer.performWithDelay( 1000, listener )

or

timer.performWithDelay( 1000, transition.to( event.target, { time=250, width=0 } ))

This causes a 1 millisecond delay and allows the cpu to complete the collision of the object and fire your transisition.

Hopefully this was your issue - if not, then your question is to generic and your going to need to paste in a block of code that we can review for you.

Lary

It is not in a collision event. I’m simply flipping a card over by scrolling the width to 0 and then swapping the card then on the new object setting the width back to the original size using a hard coded value for both.

chances are “event.target” is not a display obj or is simply null, do a simple test to check wether it exists

print( event.target and "exists" or "doesn't exist" )