lua-users home
lua-l archive

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




On 8 January 2011 11:40, David Kastrup <dak@gnu.org> wrote:
Alexander Gladysh <agladysh@gmail.com> writes:

> On Sat, Jan 8, 2011 at 13:28, David Kastrup <dak@gnu.org> wrote:
>> GrayFace <sergroj@mail.ru> writes:
>>> On 08.01.2011 14:34, David Kastrup wrote:
>
>>>> I think it should be defined as a straight noop not changing the table
>>>> at all, ever.
>
>> insert(t,n,somefunction(...))
>
>> where somefunction may decide not to return a value.
>
> You can not be sure what user meant by this. Perhaps he does want to
> insert nil.

There is no way to insert nil in a table.  No matter what the user
wants.

--
David Kastrup

I know the conversation is about table.insert but you can insert nils into a table and it does have an effect see Lua programming gems page 21. It uses a "dirty trick" to insert nils and force a rehash.