[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua-5.2.0-alpha table module problem
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 15 Dec 2010 13:59:39 +0200
On Wed, Dec 15, 2010 at 1:46 PM, joao lobato <firstname.lastname@example.org> wrote:
> While incurring the risk of being labeled flamebait, this is the kind
> of discussion around #t that I think makes sense.
It does make sense that __len is respected (less surprises for all)
but then to be consistent table.concat() should also respect
__tostring. At the moment strings or numbers are fine.
The argument against this generalization is that making concat picky
catches stupid things early, rather than having to wade through
possibly large output results to find the duds.
It is consistent then to see the table.* functions as working only on
raw tables, and thus generally not respecting your attempts at
Consider table.insert - even if your table has a __setindex to enforce
what goes into it, this function will ignore that. This is one big
difference between table.insert(t,val) and t[#t+1] = val. (This came
up when I was constructing a 'safe' array that could guarantee no
holes would be inserted..)