Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does Roblox Lua have something other scripts have?

Asked by 5 years ago

so I haven't really did anything because roblox studio crashes on me. So I was thinking if you can do variable += 1 like in a script

x = 0

while true do
    x += 1
end

instead of

for x = 0, ? do
    print('idk")
end
0
Note that "Roblox Lua" is not its own language; rather Lua with disabled libraries and some modified functions + Roblox API User#24403 69 — 5y

1 answer

Log in to vote
3
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
5 years ago
Edited 5 years ago

No += increment is not possible, neither is ++

you will have to do x = x + 1;

As for your second example, I don't know what language that is from. but the ? by itself holds no value in Lua.

I recommend you take a look at syntax of Lua.

Lua Syntax

0
+= is an increment exclusive to Python 2 DeceptiveCaster 3761 — 5y
1
MANY languages support `x +=` as a shortcut to `x = x +`. It's odd that you'd pick specifically Python 2, when Python 3 also supports the feature. fredfishy 833 — 5y
Ad

Answer this question