Unusual behavior when comparing two strings

So I have a script in which I do the following:(Example)

if string == string then

Now the problem is that it states that they’re false, but I literally went through both of the strings both of the time with print and made sure that(Who the fuck knows y not) that those are in fact strings. Also, yes just to make sure I used ( “D” … string … “D” ) to make sure that there are no spaces on either side of the string that could possibly cause the two to not match.

Does anyone know why is this happening? The strings are literally the same with the casing done properly.

Can you post code for the actual usage of this?

Exception_Location = { "Johnson" }

if Victim_Job == v and Check_Expansion_Location_1 == Check_Expansion_Location_2 then -- check1 is the "Johnson" from table and Check2 is "Johnson". Tested this multiple times, it is what I am claiming it to be.



         --some other stuff that's not related to the issue and I don't want to show kek

It’s the Check1 and Check2 vars that are not being compared properly.

With all deep honesty, with the fact that I stated that these are in fact strings and that I checked the contents of said variables, this piece of “code” is completely useless. But hey, maybe I’m wrong? lmao

Test the variables type with;

print("Type: " .. type(var),var)

(Replace the var with the two strings) to see if they’re the same type.

I already have before, but just to make sure… and… yes they are both strings.

[editline]4th September 2017[/editline]

Okay so I found a way to fix the issue.
For anyone else who might encounter this issue, what you want to do is use developer 1 if you’re checking for spacing on either side of the string and then simply replace said space with “”. I used:

string.SetChar( your_string , string.len( fucked_string ) , "" )

I used the length of the string as a location for said “impurity” because it would always appear in the end for me. For some damn reason, somewhere in the process that I double checked, a space is added to the end of the values of a table I have.

[lua]if str1:Trim():lower() == str2:Trim():lower() then[/lua]