lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


How to understand the difference between t1 and t2 in the example below? They give the same results while iterating, but `#` returns different values. Is this expected?

```lua
> t1 = {[3] = 100}
> t2 = {nil, nil, 100}
> for x, y in pairs(t1) do print(x, y) end
3       100
> for x, y in pairs(t2) do print(x, y) end
3       100
> #t1
0
> #t2
3
```