in the 2 example, the table seems do the same things.but the output is different.
local a = {
[0] = 0,
[1] = 1,
[2] = 2,
[3] = 3,
}
for i, v in pairs(a) do
print(v)
end
the output is 0 2 3 1
local a = {}
a[0] = 0
a[1] = 1
a[2] = 2
a[3] = 3
for i, v in pairs(a) do
print(v)
end
the output is 1 2 3 0
it seems like the second example is always output array part first then hash part. but the first example seems like the order is random. why?