Lua等于函数和表

时间:2014-07-11 10:25:05

标签: lua lua-table

我的代码是:

a = {"a1","a2","a3"}
b = a
b[1] = "b1"
print(a[1])

我无法理解为什么结果是" b1"而不是" a1"。

同样是:

 a = {"a1","a2","a3"}
b = a
c = b
b[1] = "b1"
c[2] = "c2"
print(a[1])
print(a[2])
print(a[3])

结果将是: " B1" " C2" " A3"

我可以用其他方式复制变量吗?

0 个答案:

没有答案