Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-18-19, 03:19 AM   #1
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
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
 

WoWInterface » Developer Discussions » Lua/XML Help » Tables again...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off