Lua基本语法

1、Lua中的变量类型有:

a = 1         --number

b = "abc"    --string

c = {}       --table

d = print    -- function

e = true     --bool

2、Lua变量名大小写敏感,不要以_开头,这些都表示一些特殊变量

3、关键字: and、beak、do、else、elseif、end、false、for、function、if、in、local、nil、not、or、repeat、return、then、true、until、while

4、string类型的字面值有:“”、‘’、和多行字符串[[ ]]三种

5、Lua允许多个变量同时赋值,例如: a,b = 1,2   a,b = b,a表示交换两个变量

6、输出到console的方式: print("hello world")、  io.write("hello world")

t = {name = "kylin", age = 18, gender = "male"}  -- 此为一个table类型的变量

原文地址:https://www.cnblogs.com/kylinxue/p/4617819.html