Just want to know why it's not working.

Can someone explain me why it is sending this message?

error —> main.lua:6: attempt to perform arithmetic on global ‘width’ (a nil value) <—

local centerX, centerY = display.contentCenterX, display.contentCenterY local square = display.newRoundedRect( centerX, centerY, 32, 32, 12 ) local function makeItBiggerByEasing(event) &nbsp; event.target = mySquare &nbsp; local myTransition = transition.to( mySquare, { width = width + 5,height = height + 5, time = 350, transition = easing.OutQuad } ) end square:addEventListener("tap", makeItBiggerByEasing)

I am using a Chromebook C720 with Elementary OS as operative system and PlayOnLinux to run Corona,

any ideas?

Hi nosoyhackercodigo,

You should replace width with_mySquare.width_. The same think apply to height field. So code

width = width + 5

change to

width = mySquare.width + 5

Read more

Have a nice day:)

ldurniat

@ldurniat is correct.

Additionally, variable extraction code is written backwards. 

Why are you assigning values to the event?  That won’t do anything.

This is the correction I would suggest (with @ldurniat’s change too):

local centerX, centerY = display.contentCenterX, display.contentCenterY local square = display.newRoundedRect( centerX, centerY, 32, 32, 12 ) local function makeItBiggerByEasing(event) local mySquare = event.target local myTransition = transition.to( mySquare, { width = mySquare.width + 5, height = mySquare.height + 5, time = 350, transition = easing.OutQuad } ) end square:addEventListener("tap", makeItBiggerByEasing)

It’s working!

You guys respond really faster!! It’s amazing!

Assigning values to the event…My mistake, sorry.

Thank you Idurniat and roaminggamer, you both are awesome people in this community.

Keep doing the good work.

Hi nosoyhackercodigo,

You should replace width with_mySquare.width_. The same think apply to height field. So code

width = width + 5

change to

width = mySquare.width + 5

Read more

Have a nice day:)

ldurniat

@ldurniat is correct.

Additionally, variable extraction code is written backwards. 

Why are you assigning values to the event?  That won’t do anything.

This is the correction I would suggest (with @ldurniat’s change too):

local centerX, centerY = display.contentCenterX, display.contentCenterY local square = display.newRoundedRect( centerX, centerY, 32, 32, 12 ) local function makeItBiggerByEasing(event) local mySquare = event.target local myTransition = transition.to( mySquare, { width = mySquare.width + 5, height = mySquare.height + 5, time = 350, transition = easing.OutQuad } ) end square:addEventListener("tap", makeItBiggerByEasing)

It’s working!

You guys respond really faster!! It’s amazing!

Assigning values to the event…My mistake, sorry.

Thank you Idurniat and roaminggamer, you both are awesome people in this community.

Keep doing the good work.