8 posts
Location
United States
Posted 18 January 2013 - 03:55 PM
I was wondering how I can do += in lua. I want to add a number to a variable without re declaring it. This way that variable will keep the same information.
2217 posts
Location
3232235883
Posted 18 January 2013 - 03:56 PM
normal expressions like (5 - 6) wil work without declaring
the numbers can be replaced with a variables name
1190 posts
Location
RHIT
Posted 18 January 2013 - 04:21 PM
@Pixel: You might want to rephrase that… I'm not sure what you're trying to say.
There is no += operator in Lua, but "var = var + 1" is perfectly legal.
7508 posts
Location
Australia
Posted 18 January 2013 - 04:22 PM
what your asking for is a little confusing. As Bubba stated there is no += operator. And even if there was doing
var += 2
actually still 're declares' the variable… its just short-hand for
var = var + 2