Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

For some reason doesn't matter what string, it still passes in?

Asked by 3 years ago

script :

local job = string.split(str,",")
if job[1] == "Visitor" or "Raider" then
    print(job[1])
end

for some reason even when job[1] string isn't visitor or raider it still passes and prints job[1] and I don't know why, any ideas?

0
you need to do "if job[1] == "Visitor" or job[1] == "Raider then", the "or" is to do another check the first check is false or nil. yHasteeD 1819 — 3y

1 answer

Log in to vote
1
Answered by
orcazate 170
3 years ago

You can't just use or you need to check the value again.

local job = string.split(str,",")
if job[1] == "Visitor" or job[1] == "Raider" then
    print(job[1])
end
Ad

Answer this question