Allow "not equal to" operator "~=" in Luau to be written as "!="

theres no lua ide for jetbrains

I don’t get the point of it being “inconsistent”. You can get the length of a string using the # operator, or using string.len(str) function, which both do the same. I know they are in vanilla Lua, but I have seen no one to cry about inconsistency because of that.

You can also concatenate a string either using the .. operator or string.format().

Now talking about the changes Roblox added to Lua is shortening variable addition, subtraction, etc…

local b = 5
b += 10
print(b) --> 15

This is a feature many languages have, and it doesn’t create any inconsistency either. You can either do it using b += 10 or using b = b + 10.

So why would it be a problem with ~= and !=? It’s not like changing the starting index to 0, which would break lots of code.

Also another thing Roblox added is the Random class.
You can either use that like Random.new():NextInteger(1, 100) or math.random(1, 100) which litreally do the same. Isn’t that inconsistent?

1 Like

Luau will not be adding additional syntax for inequality or negation. We follow a design philosophy similar to C#'s Minus 100 Points meaning that every individual feature we’d want to consider adding to the language is “in the hole” so-to-speak and needs to significantly justify itself in order to warrant being worth the addition. This feature would add no additional capabilities for programmers, add inconsistency between semantically-identical comparisons, would reserve the symbol ! for something that is already expressible in the language, and lacks a motivation beyond “similarity to other languages” (this is a useful component when designing new features, but it is never a reason on its own). As such, it does not hold up to the intentionally very high bar for the language.

I recognize this may nevertheless be disappointing to hear if you’re already convinced of the necessity of this feature, and I’m sorry for that! Designing a coherent product requires us to say no a lot though, even when there is nothing wrong with the idea in a vacuum. Whether or not you agree with the reasons folks do not feel this feature justifies itself, this is one such case where we have to say no. There’s no need to spend energy debating it further.

8 Likes

Random is not a feature of Luau, its a Roblox specific API, both use the same randomisation algorithm.

On the topic of strings, the reason this works is because strings just have a metatable pointing to the string table, so its just syntax sugar, this has legitimate usecases unlike != where it would just be replacing ~ with ! which is pretty redundant.

You could also argue that the : sugar call is inconsistent, because you can implement it with . by defining the first argument as self

local t = {}

function t.foo(self)

end

function t:foo()

end

Are you going to call this inconsistent behaviour?

1 Like

I get that Random is technically part of Roblox API and not Luau itself, but that’s kind of my point, it’s still available to use alongside math.random, and they both serve the same purpose. No one complains that’s inconsistent, even though they’re separate things with the same result.

And saying strings having a metatable makes it “legit” doesn’t change the fact that from a dev’s perspective, you can still do the exact same thing in two different ways: #str vs string.len(str). Whether it’s metatables or not, it’s still functionally redundant, and it exists to make things more flexible.

Same goes for : vs .. You can define methods manually by passing self, but Lua gives you the cleaner way using :. Is that inconsistent? Not really. It’s just more readable and easier to work with.

So why would adding != suddenly be a problem? It’s just another option, like how += was added. Nobody forces you to use it, and it doesn’t break existing code. If anything, it makes the language a bit more welcoming for people coming from other languages. It’s not like it adds confusion, it’s literally doing the same thing with a symbol people are already familiar with.

Rejecting it just because it’s “syntax sugar” ignores how helpful sugar is for writing clean, readable code, especially in a platform like Roblox where devs come from all kinds of backgrounds.


It’s like saying “Well, technically that’s not part of JavaScript, it’s part of the browser API” when we’re clearly talking about using it in the browser. Who cares? You’re still writing JavaScript for the platform.

Your point makes no sense here. You want something implemented in the language and are trying to justify that by using examples of things implemented to interface with the program in some way by said program that is only using the language.

But += serves an obvious purpose, it shortens what would normally be a much longer piece of code into a few characters (path.to.variable = path.to.variable + 6 vs path.to.variable += 6). But what does != serve? It doesn’t shorten any longer pieces of code by existing nor does it make anything more readable than it already is.

1 Like

Did you miss this by chance?

char limit

Yes

I am precisely saying that

It’s equivalent to saying “not true”

yes please lol i dont even know how to type that symbol on my keyboard because it aint available lol.

1 Like

The expression is actually evaluated as (not X) == Y, not not (X == Y). It isn’t equivalent to X ~= Y.

1 Like

Actually, it makes perfect sense. The examples used like : vs . or math.random vs Random.new() are about usability and flexibility within the ecosystem, not some arbitrary separation between “language” and “API.” Developers using Luau aren’t mentally dividing their workflow into “this is the core language” vs “this is the Roblox API.” They just write code. And the fact that Luau already allows multiple ways to do the same thing in several cases shows that user-friendly redundancy is already a design choice in the language. Adding != fits right into that philosophy. It’s about making the experience smoother for developers, not about philosophical language purity.


If saving keystrokes is your gold standard for language features, then why are you okay with and instead of just &&? Oh right, readability. Now apply that same logic to !=.

!= serves the same purpose as +=, not to shorten code, but to improve readability and familiarity. Most languages use !=, so adding it makes Luau more intuitive for new devs without breaking anything. It’s not about replacing ~= but offering a common alternative for clarity.

1 Like

Yeah, I saw the admin’s post, but I still think debating the idea has value. Different perspectives matter, even if the devs already said no. Just like with the SSR feature, people still want it, even if it’s not a priority.

If you’re on Windows you can hold ALT and type 126 and let go off ALT. It will insert the ~ character

I think you can hold Shift and press the ` key on the left of the 1 key on most keyboards (at least, every keyboard that I have ever used) as well.

It’s not a priority because it’s never coming. This whole thing is dumb, engineers already explained their (perfectly reasonable) design philosophy, there is nothing left to debate because nothing will come out of it. This is the type of discussion for the discussion category, not an engine feature post.

If you didn’t read every word, maybe give their reply a re-read. I shouldn’t be constantly getting notifications for people liking a reply I made to this post two years ago. Bumping this post only pushes down other active feature requests, and it at this point it’s just bloat from the replies.

The only thing stupider than thinking you can debate your way out of hard-set design philosophies designed by industry professionals is thinking that the debate will have any productive value.

3 Likes

I get that the decision was made and the official reasoning has been posted. I’ve read it, multiple times,in fact. But discussion around design decisions (especially longstanding ones) is still valuable. The fact that people are still engaging with this years later says something, even if it’s liked by the community or not.

If seeing replies and likes is annoying, unfollowing the thread might be a better solution than trying to silence the discussion entirely. That’s just how forums work.

Also, as someone tagged as a game designer, I’d think you’d appreciate the importance of community input, feedback loops, and evolving perspectives. That’s the backbone of good design, isn’t it?

how about have both ~= and != work

so many games have scripts with ~=, many of which dont get updated anymore due to age, dying player count, or lack of interest to developers

so many people would be confused as to why ~= doesnt work anymore, so it would be better to allow both and leave it up to preference

You’re describing DevOps, which prevents something like this from taking effect. The feedback here has already been heard and a decision was made, there is no more community input part to it that is part of the DevOps process.

And yes, I’ll be unfollowing this thread now.

That’s the thing tho, the whole thread was just about supporting both operators, not dropping support for the ~=.

makes me sad ;c

Oh well, I guess it makes sense for billion dollar companies to tend to be more lazy boring than cool, especially when they have a thousand things they can work on.

I’m marking this as the solution.