num = 100 --number str = 'hello' --string b = true --boolean tab = {1,3,5,7,9} --table first = tab[1] --number local loc = 2 --局部变量 print(type(num)) --number print(type(str)) --string print(type(b)) --boolean print(type(tab)) --table print(type(first)) --number
Lua变量的数据类型都是动态确定的
没有整数类型,number称为小数类型
table类型其实就是数组类型
没有加local的变量都是全局变量