Tables again...
Could someone please help me with this :
t = { };
t["a"] = "alpha"
This means key is string "a" and value is string "alpha". This will never change unless I assign another value to it explicitly.
Now we do,
t[1] = 100
This means the key is unknown, the value is the number 100 (or is it a string?).
If we pairs(t) now we get
k:1, v:100
k:a, v:alpha
Then we do
table.insert(t, 1, 500)
If we pairs(t) now we get
k:1, v:500
k:2, v:100
k:a, v:alpha
So it appears keys 1 and 2 are not immutable keys but positions disguised as keys ? It is all so confusing.
Last edited by doofus : 12-18-19 at 03:37 AM.
|