A strange error

Hello guys

I tried to make this function

local bg = display.newImage("bg.png") bg.x = 12 function move(self , event) self.x = self.x - 10 end bg.enterframe = move Runtime:addEvenListener("enterframe", bg ) function win() if bg.x = -100 then print ("you win") end end win()

But when I run It it says ‘’ Error ''then" expected near “=” …"
How can I solve it??

Try:   if bg.x == -100 then

two equal signs means “Is equal to”, a single equal sign means “assign value to”

Rob

really helpfull thanks

Try:   if bg.x == -100 then

two equal signs means “Is equal to”, a single equal sign means “assign value to”

Rob

really helpfull thanks