Hey, I'll go straight to it.. Can someone please explain to me why these two are the same thing but both give different outcomes?
if matches[4] ~= "Scent" then
if not matches[4] == "Scent" then
One day one will work and the other doesn't and the next both will work.. I'm at a complete lost as to whats happening!..
Which is the correct way to do the above ^
Help: An Off Issue
Re: Help: An Off Issue
the second version can be translated as
if (not matches[4]) == "Scent" then
which probably not what you want. Version 1 is the correct one, though you could write it as
if not (matches[4]=="Scent") then
as well.
if (not matches[4]) == "Scent" then
which probably not what you want. Version 1 is the correct one, though you could write it as
if not (matches[4]=="Scent") then
as well.
Re: Help: An Off Issue
I had it as if not (matches[4] == "scent") then .. that didnt work .. lol just spent a hour going through everything and the only one that does seem to work is.. if matches[4] ~= "Scent" then .. even tho yesterday that didnt work :/
Re: Help: An Off Issue
You're basically trying to evaluate a boolean against a string. So your second example is basically saying (assuming matches[4] has a value), if false == "Scent" then ... end.
Re: Help: An Off Issue
Also remember "scent" and "Scent" are different things.
Re: Help: An Off Issue
I was using Scent ..
but still doesn't answer why if not matches[2] == "Scent" is different from if matches[2] ~= "Scent" i would have thought the if not would be better :/
but still doesn't answer why if not matches[2] == "Scent" is different from if matches[2] ~= "Scent" i would have thought the if not would be better :/
Re: Help: An Off Issue
It does answer... Read feteaera's and my answer again...
not matches[4] == "Scent equals (not matches[4]) == "Scent" which is false == "Scent"
ETA: and "~=" is usually the easier understood version of "not equal" anyways....
not matches[4] == "Scent equals (not matches[4]) == "Scent" which is false == "Scent"
ETA: and "~=" is usually the easier understood version of "not equal" anyways....
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Help: An Off Issue
Unless you're a C/C++ coder who keeps trying to use "!=".