LUA中并没有?:操作符:p,但是玩转and和or,一样能用一个表达式写出分支来!
奥妙在与and和or的返回值:
参考
www.lua.org/manual/5.1/manual.html#2.5.3
cesarbs.org/blog/2009/10/23/why-luas-0-zero-as-a-true-value-makes-sense/
我的方案
LUA条件判断中,所有的number(包括0)都是true,nil是false
LUA中并没有?:操作符:p,但是玩转and和or,一样能用一个表达式写出分支来!
奥妙在与and和or的返回值:
参考
www.lua.org/manual/5.1/manual.html#2.5.3
cesarbs.org/blog/2009/10/23/why-luas-0-zero-as-a-true-value-makes-sense/
我的方案
LUA条件判断中,所有的number(包括0)都是true,nil是false