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
原文地址:https://www.cnblogs.com/sanyejun/p/9274926.html