equality or approximately equal?

I am currently working on a script of mine for my server, and being new to lua and horrible at math I can’t seem to figure out which of these to use.


if ply:Team() ~= TEAM_MAYOR or ply:GetUserGroup() ~= "superadmin" then

approximately equal

if ply:Team() == TEAM_MAYOR or ply:GetUserGroup() == "superadmin" then

If you could please explain when to use equality and when to use approximately equal I would really appreciate it!

The “~=” operator checks for inequality, not approximation.

So which one would be used in my situation?

You use “==” if you want to test that the values are equal. Otherwise, you use “~=” to make sure they’re not equal.

Alright, and while I have your attention, may I ask a few more questions? (2 more after this question)

[editline]3rd February 2016[/editline]

Nevermind, found a great site with this information. Mathematical, but understandable coding wise.