local mm = { [2] = 3, ["2"] = 4 }
print("=============================")
print(mm[2])
print(mm["2"])
print(mm[tostring(2)])
print(mm[tonumber("2")])
mm[2] = 6
mm["2"] = 7
print("-----------------------------")
print(mm[2])
print(mm["2"])
print(mm[tostring(2)])
print(mm[tonumber("2")])
>lua -e "io.stdout:setvbuf 'no'" "mm.lua"
=============================
3
4
4
3
-----------------------------
6
7
7
6
>Exit code: 0
lua table 使用记录
最新推荐文章于 2020-11-06 14:03:58 发布