ADDING NUMERIC VARIABLES

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]

Never-mind the variable for some reason was out of scope, even-though it is a Global variable. I ended up finding a better way anyways… [import]uid: 7197 topic_id: 4893 reply_id: 15767[/import]

yeah definitely something wrong there

[lua]pointsLeft = 50
– event.object1.points = 100
print(pointsLeft + event.object1.points) – = 100[/lua]

should actually be 150
[import]uid: 6645 topic_id: 4893 reply_id: 15771[/import]