[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Applying the # operator on a table
- From: Romeu Braz Pereira Gomes Filho <bpgomes55@...>
- Date: Mon, 8 Apr 2013 10:25:07 -0300
I was testing the # operator on a table and got some strange results.
The chunk used was:
t = {10, 20, nil, 40}
print(#t) --> 4 (should not be 2?)
t = {10, nil, nil, 40}
print(#t) --> 4 (should not be 1?)
t = {}; t[1] = 10; t[2] = 20; t[3] = nil; t[4] = 40;
print(#t) --> 4 (should not be 2?)
t = {}; t[1] = 10; t[2] = nil; t[3] = nil; t[4] = 40;
print(#t) --> 1 (OK)
Is this an expected result or a bug?
Regards,
Romeu.