I am simply trying to get the sum of two numbers…
I am trying to add two numeric values, with their values are represented in variables. This should be straight enough, what am I doing wrong? Below is what I have tried. I have tried this with and without the tonumber().
[code]
pointsLeft = 50
– event.object1.points = 100
print(pointsLeft + event.object1.points) – = 100
pointsLeft = tonumber(pointsLeft) + tonumber(event.object1.points)
txtScoreLeft.text = pointsLeft
–txtScoreLeft.text = 100
– this ends up overriding pointsLeft with event.object1.points, and not the sum of the two
[/code] [import]uid: 7197 topic_id: 4893 reply_id: 304893[/import]