[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: about table.insert return value (==nil)
- From: John Passaniti <john@...>
- Date: Sun, 20 Dec 2009 17:52:36 -0500
On Sun, Dec 20, 2009 at 10:05 AM, Ico <email@example.com> wrote:
> I guess the other 'logical' behaviour would be to return the newly
> inserted element instead of the table:
> thing = table.insert(sometable, new_thing())
> Maybe neither is implemented because they're both equaly logical ?
I'd say that returning the item being inserted is at least consistent
with table.remove, which returns the removed item.
Of course, one can always write a wrapper around table.insert to
return anything desired.