lua三目运算符

lua的类似三目运算符用法

一般化的Lua三目运算为:(a and {b} or {c})[1]

local v = (a and {b} or {c})[1]
如果a为true,则 v = b
如果a为false,则 v = c

原理解析:
https://blog.csdn.net/coffeecato/article/details/77546887
posted @ 2018-07-06 17:52  三页菌  阅读(228)  评论(0编辑  收藏  举报