lua-users home
lua-l archive

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

On Tue, 2011-01-11 at 08:05 +0100, Henning Diedrich wrote:
> On 1/10/11 11:50 AM, David Kastrup wrote: 
> > 
> > Putting nil in continuously maintained arrays will cause vast
> > performance problems and unpredictabilities.
> > 
> > Just don't.  nil is there for a reason, and that reason is _explicitly_
> > not being a table element.
> Like you put it, you should not be able to assign it to a table in any
> way, ever.
> To 'delete' values, however, you kind of have to --- or at least until
> you understand you should simply never delete values ... it's all too
> difficult.

Maybe I'm missing something, but I thought that 'nil' is exactly for
that - deleting values from tables. 'nil' means absence of a value.

When t[k] is nil, table 't' doesn't have a value associated to 'k'.
t[k] = nil removes the value associated to key 'k' from the table 't'.

Is it difficult to understand? Should I not do it?