16353人加入学习
(66人评价)
Lua编程
价格 免费

tab1={} --空表

tab2={key1=100,key2="value"} --有键对应值的表

tab3={"apple","pear","orange","grape"} --无键对应的表

for key val pairs(tab1) do

print(key ..":"..val)

end

 

表的使用方式

调用

tab1.key1="ANYU"

tab1["key1"]="anyu"

print(tab1.key1)

print[tab1["key1"]]

[展开全文]