Steam 설치
로그인
|
언어
简体中文(중국어 간체)
繁體中文(중국어 번체)
日本語(일본어)
ไทย(태국어)
Български(불가리아어)
Čeština(체코어)
Dansk(덴마크어)
Deutsch(독일어)
English(영어)
Español - España(스페인어 - 스페인)
Español - Latinoamérica(스페인어 - 중남미)
Ελληνικά(그리스어)
Français(프랑스어)
Italiano(이탈리아어)
Bahasa Indonesia(인도네시아어)
Magyar(헝가리어)
Nederlands(네덜란드어)
Norsk(노르웨이어)
Polski(폴란드어)
Português(포르투갈어 - 포르투갈)
Português - Brasil(포르투갈어 - 브라질)
Română(루마니아어)
Русский(러시아어)
Suomi(핀란드어)
Svenska(스웨덴어)
Türkçe(튀르키예어)
Tiếng Việt(베트남어)
Українська(우크라이나어)
번역 관련 문제 보고
Are you wanting the If condition to be True when the value is not equal to either of your variables?
Something in the lines of this, maybe?
Not a LUA-expert, but some coding experience.
currently I've got 2 other if statements above the problem one,
if(codeValue == ABCD)
then
XYZ
end
if(codeValue == 1234)
then
123
end
if(codeValue ~= ABCD or 1234 )
then
"NOT WORK PROPERLY"
end
Probably not the most optimised way of doing it I know but I don't know any other way.
And I thought the same Rasputin, when you use an operator in the script it colours it purple and this doesn't happen with "!="
if (codeValue == 1234) then foo(x) end
vs.
if (codeValue == 1234) foo(x);
So much excess writing
If codevalue = ABCD
then xyz
Elseif codevalue = 1234
then 123
Else something
end
'if( x ~= ABCD and x ~= EFGH )' is the same as 'if not (x == ABCD or x == EFGH)'
You have to consider the or-argument isn't what you read out in plain English.
See more here if you like:
De Morgan's Laws[en.wikipedia.org]
Yeah, don't like the '~='-syntax myself. It is very unintuitive on the keyboard :P
I don't entirely understand why this works but it does so thank you.
And also I originally thought ~= meant roughly equal to instead.
Nice! Glad you got it working.
To sum it up, you were telling the program to evaluate
- x ~= ABCD (true or false depending on the situation)
or
- 1234 (which if it is not nil is true)
(true) or true is : true, (false) or true is : also true, thus your condition was always true, hence the program was not behaving like you expected it to.
EG:
If codevalue = ABCD
then xyz
Elseif codevalue = 1234
then 123
Elseif codevalue >= XYZ
then
Elseif codevalue <= 9876
then
Else something
end
Would this work?
Yes, but it will stop where the expression is true and not test more expressions.
(EDIT: Which is a good thing! Writing multiple IF's is forcing the script to check each statement. ELSEIF's can improve performance)
See syntax:
LUA IF ELSEIF ELSE[www.tutorialspoint.com]
Exactly! As I said the OR-operator is not what you read out in plain English and the OR-operator comes last in the precedence - it is evaluated last.
But that guy explained it better than I can :)