Is It Greater!

Hey guys how do I figure out in a function if a certain variable is greater then another variable call the function.

local buy = widget.newButton { left = -45, top = 350, id = "buybtn", label = "Buy", } function isitgreater( event ) if score1 \> score2 then print("It is greater") score.subtract(event.target.value) end end buy:addEventListener("touch",isitgreater)

Your button “buy” doesn’t have a member named .value.   I also can’t tell from this code segment what values score1 and score2 have.  If score1 and score2 are numbers, then you’re testing things correctly.  But currently you’re passing nil to score.subtract.

Rob

Your button “buy” doesn’t have a member named .value.   I also can’t tell from this code segment what values score1 and score2 have.  If score1 and score2 are numbers, then you’re testing things correctly.  But currently you’re passing nil to score.subtract.

Rob