Pol*_*yov 17 logic lua if-statement
我刚刚开始使用Lua,我想知道(因为我在网站上找不到它)如果Lua有一个OR运算符,就像其他语言中的那样||:
if (condition == true || othercondition == false) {
somecode.somefunction();
}
Run Code Online (Sandbox Code Playgroud)
而在Lua,有
if condition then
x = 0
end
Run Code Online (Sandbox Code Playgroud)
我如何在Lua中编写IF块来使用OR?
Pup*_*ppy 27
用"或".
if condition or not othercondition then
x = 0
end
Run Code Online (Sandbox Code Playgroud)
正如Lua手册中明确指出的那样.