lua and or not 逻辑运算符

按 c 风格写多条件判断,会出异常, 如  if ( cond1& cond2 ){ do something; };

lua写成 

if  cond1 and cond2 then

     do something

end

这样会出异常, 当 cond1 为false时直接返回 cond2 的值, cond2 true就会执行 do something了。

需要改为  

if  cond1 == true and cond2 == true then

     do something

end

posted @   锐洋智能  阅读(41)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 分享4款.NET开源、免费、实用的商城系统
· 解决跨域问题的这6种方案,真香!
· 5. Nginx 负载均衡配置案例(附有详细截图说明++)
· Windows 提权-UAC 绕过
点击右上角即可分享
微信分享提示