一、算术运算符
二元:+ - * / ^
一元: -
二、关系运算符:
< > <= >= == ~=(不等于)
三、逻辑运算符:
and or not
a and b: return a if a is false, else return b
a or b: return a if a is true, else return b
四、连接运算符: ..
五、优先级:
^
not -
* /
+ -
..
< > <= >= ~= ==
and
or
*六、table
一般构造法:opnames = {["+"]: "add", ["-"]: "minus"}
逗号可用分号代替,用于分隔不同类型元素;最后可留逗号用于扩展
table 构造 list:
list = nil
for line in io.lines() do
list = {list.next = list; value=line}
end