|
| 10 Apr 2016 05:24 PM |
This petition is to have ROBLOX implement the "+=" operator, as well as the "-=", "*=", and "/=" operators.
The += function is for setting the value of a value. So basically instead of having to type out "script.Parent.Value = script.Parent.Value + 1", we can type out "script.Parent.Value += 1" and its the same with "-=", "*=", and "/="
This would make things much easier for scripting!
It's simple physics R$48 |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 10 Apr 2016 05:25 PM |
| That's not something they can add. It would have to be something the lua developers add, and even then I don't think it's possible due to the way lua works. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 05:27 PM |
pretty sure it would have been put in already if it was possible, you're not exactly the first person to ask for this.
but sure, this would be nice if it could be done. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 05:38 PM |
| Possible to add but it wasn't added in for a reason. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:38 PM |
what was the reason?
I just request it because I code in java too and its a nice feature
It's simple physics R$48 |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 06:46 PM |
Lua doesn't use += so
¯\_(ツ)_/¯ |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 08:39 PM |
| Probably because it's too much bloat for a language that's meant to be tiny |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 10 Apr 2016 08:46 PM |
Regardless of why we don't have it, why do we need it?
Being too lazy to do x = x+1 Isn't a good enough reason.
If we are to assume that the interpreter doesn't optimize x=x+1, then you're saying you're doing something soo performance heavy that +=, -=, and the like will make a difference. If you're doing something where this optimization is required, you're doing it wrong or shouldn't be doing it in an interpreted language to begin with. |
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 08:55 PM |
x = x + 1 cant be optimized in Lua, and x += 1 will produce the same exact instruction as x = x + 1. It's purely bloat, the way I see it: Lua is meant to be compact, adding 5-10 more operators bloat the compiler for no actual benefit. In other languages, += can typically lead to more optimized code (assuming optimizations don't do that already) but not in Lua (if those operators did exist). It's a waste.
+=,-=,*=,/=,%= is just the start, in Lua 5.3 they'll need even more (new operators) and people will no doubt also want ++,-- unart operators, then they'll want the true ternary operator then they'll want multiple assignments in a statement and suddenly you have a 3x bigger language. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 10 Apr 2016 08:57 PM |
+= looks ugly as f. thats why it shouldnt be added
|
|
|
| Report Abuse |
|
|
TIV67
|
  |
| Joined: 05 Mar 2014 |
| Total Posts: 630 |
|
|
| 10 Apr 2016 08:59 PM |
no. i hate everything that has to do with java with a passion
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 09:48 PM |
"no. i hate everything that has to do with java with a passion" Because += is certainly Java.
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 09:49 PM |
op mentioned += was from java that was my other account, i forgot to log off and i know += is an operator in other languages, but that operator looks ugly as frick.
|
|
|
| Report Abuse |
|
|
|
| 10 Apr 2016 09:51 PM |
Oh, I didn't see that. My bad.
|
|
|
| Report Abuse |
|
|