table的使用:
redat1 = {["mon"] = 1, ["tue"] = 2} print(redat1["mon"]) redat2 = {1, 3} print(redat2[1]) 输出:1 1
二维:
d = {} d[1123] = {["q"] = 1,["w"] = 2,["e"] = 3} print(d[1123]["q"]) 输出:1
多维:
local a = {}
a[10] = {nil, {["姓名"]="张三"},{["阿杏"] = {["年龄"] = "22"}, ["阿讯"] = {["年龄"] = "22"}}}
print(a[10][2]["姓名"])
print(a[10][3]["阿讯"]["年龄"])
输出:张三 22
时间: 2024-11-13 09:28:04