08 December 2014

table

###table用法

p={
	[2]="apple",
	[3]="qqq",
	["boy"]="girl",
	crash="123",
	"dog",
	"test"
}
print(p["crash"])   --123
print(p.crash)      --123
print(p.boy)        --girl
print(p["boy"])     --girl  两种写法都可以
print(p[1])         --dog
print(p[2])         --test 被覆盖掉了
print(p[3])         --qqq


blog comments powered by Disqus