lua-users home
lua-l archive

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


On Sun, Dec 20, 2009 at 10:05 AM, Ico <lua@zevv.nl> 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.