Quantcast
WoWInterface - View Single Post - Tables again...
Thread: Tables again...
View Single Post
12-19-19, 05:15 PM   #4
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
I am more confused now

t[1] = 100
t[2] = 200
t["hello"] = "goodbye"

which is a data structure where:

k:1 v=100
k:2 v=200
k:hello v="goodbye"

Naturally we take 1, 2, "hello" to be "keys" in the traditional sense of sets/maps

Then we do:

table.insert(t,1,500)

and this gives

k:1 v=500
k:2 v=100
k:3 v=200
k:hello v="goodbye"

So even though t["hello"] does not change, t[1], t[2], t[3] etc might all change if I do table.insert() ??

This is not at all how sets or maps work, so I find this data structure weird... I am confused.
  Reply With Quote