Lua语言备忘
保留字:
| and | break | do | else | elseif |
| end | false | for | function | if |
| in | local | nil | not | or |
| repeat | return | then | true | until |
| while |
基本数据类型:
nil、boolean、number、string、userdata、function、thread、table。函数 type 可以测试给定变量或者值的类型。
算术运算符
1. 二元运算符:+、-、*、/、^ (加减乘除幂)
2. 一元运算符:- (负值)
关系运算符
< > <= >= == ~=
不等符号比较特别,其他的和C语言一样。
逻辑运算符
and or not
连接运算符
.. (两个点)
运算符优先级,从高到低
^
not - (一元运算符)
* /
+ -
..
< > <= >= ~= ==
and
or
控制结构
if conditions then
then-part
end
if conditions then
then-part
else
else-part
end
if conditions then
then-part
elseif conditions then
elseif-part
.. (多个 elseif)
else
else-part
end
浙公网安备 33010602011771号