Difference Between Equals

There are many ways to incorporate equal signs in Lua. Below is a list of every equal case you will ever need.

=

You would want to use "=" if you are assigning a value. This is most commonly used in variables.

==

You would want to use "==" if you are checking if a value equals something. This is most commonly used in if statements.

~=

You would want to use "~=" if you are checking if a value is not equal to something. This is also commonly used in if statements.

<=

You would want to use "<=" if you are checking if a value is less than or equal to something. This is also commonly used in if statements.

>=

You would want to use ">=" if you are checking if a value is greater than or equal to something. This is also commonly used in if statements.

Last updated