Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why do they use this sometimes?

I never understood this:

if (game.Workspace.Base.Tag.Value == 'Made by UltraUnitMode') then
game.Workspace.Base.Tag.Value == 'Made by No One'
end

3 comments

2

What didn't you understand about it? If the ValueObject Tag located under Base's value is equal to "Made by UltraUnitMode" then the script will change the value to "Made by No One".

1

I meant the ( )

0

You should have said that in the question. (Please edit it)

1 answer

✓ Accepted answer

There is not a good reason for the () in a condition in Lua. They are redundant and don't make things clearer. Perhaps it makes it easier to add logical operators like not and and to it, but that's probably not worth it.

However, many other programming languages require () around conditions.

  • JavaScript
  • Java
  • C
  • C++

It's most likely a hold-over from the author's experience in that language.

It's unnecessary in Lua, and is usually unnecessary in those lanuages. Go, which has a similar syntax to C, C++, Java, JavaScript did get rid of the () (and actually made them illegal).

This discussion is preserved as it was. New answers, comments, and votes are closed.