tab1 = { key1 = "val1", key2 = "val2", "val3" }
for k, v in pairs(tab1) do
print(k .. " - " .. v)
end
print("\nafter\n")
tab1.key1 = nil
for k, v in pairs(tab1) do
print(k .. " - " .. v)
end
输出:
1 - val3
key2 - val2
key1 - val1
after
1 - val3
key2 - val2
|
请发表评论