变量分为全局变量和局部变量,全局变量顾名思义,全局皆可访问的变量,而局部变量只能在声明的域中进行访问。 a=1function demo(){ local b=2 print(b)}demo()print(b)print(a)--[[依次输出2nil1]]