I know ScriptingHelpers is a place to submit scripts and get them fixed, but after 3 days of throughout search on the Internet, I still have not found an answer to my question.
Does RbxLua have a method similar to the '++' in C?
Because I keep using that method in a more conventional and longer way (Variable = Variable + Increment).
Any feedback will be appreciated. If you think my question is inadequate, comment about it and I will take it down.
:)
Lua doesn't have a unary increment operator, so you'll have to make do with var = var + 1
. The reason is that expressions like that with complex expressions to be assigned to are a bit heavy on lexers / token filters, and would be almost excessive with a lightweight language like Lua.
No.
This is basically to keep Lua simple. While it's clear what would be done in something like
a += 1
What does
a.b[c] += 1
do?
You can have metamethods handling each get... and there are lots of reasons (mostly performance, but also semantics, because of the complexity that metamethods can allow) you'd want it to have a different behavior from
a.b[c] = a.b[c] + 1