WoWInterface - View Single Post - Tables again...
Thread: Tables again...
View Single Post
12-18-19, 03:19 AM   #1
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
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.
  Reply With Quote