[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: The table length is not correct
- From: zhu honglei <zhuhongleizhl@...>
- Date: Fri, 6 Mar 2009 20:22:09 +0800
All,
I come to a strange problem. the table length is not correct. (my set up is Lua5.1.3 in Linux)
local t={"aaa","bbbb"} for k, v in pairs(t) do
if v=="aaa" then t[k]=nil end
end
table.sort(t, function(x, y) return string.lower(x) < string.lower(y) end)
the error is: bad argument #1 to 'lower' (string expected, got nil)
It seems GC does not work well, the nil value pass to table.sort. Could someone explain why it is.
Or My code is wrong?
thanks in advance,
Best Regards,
Leon