Creating tweens for multiple Gui elements

if you put:

hello[6] = 'jdkh'
hello[5] = 'nxzvzk'

after defining the table, you’ll see the difference.

The problem is, never rely on this behavior. Always use ipairs for lists. If you make a dictionary (list and dictionary are both tables in lua), where for example you go like hello.yes = 5, you’ll need pairs because ipairs won’t pick up the yes.

1 Like
u={}
u[1]="a"
u[3]="b"
u[2]="c"
u[4]="d"
u["hello"]="world"

for k,v in pairs(u) do print(k,v) end
for k,v in ipairs(u) do print(k,v) end

Expected output:
pairs

1 a
2 b
3 c
4 d
hello world

ipairs

1 a
2 b
3 c
4 d

Basically for tables / arrays use ipairs. (Where the index will always be numerical)
And for dictionaries use pairs. (Mix of numberical indexes and / or words)