lua-users home
lua-l archive

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


On Wed, 2013-05-29 at 22:51 +0200, Dirk Laurie wrote:
> 2013/5/29 Luther <lutheroto@gmail.com>:
> > In a nutshell, my question is this: If I put lots of nils into a long
> > array, will the table move its elements to the hash part to save memory?
> >
> Note the sentence:
> 
>    The actual size of the array is the largest `n' such that at
>    least half the slots between 0 and n are in use.
> 
> Later in the code (this is ltable.c, BTW) one finds
> 
>    if (nasize < oldasize) {  /* array part must shrink? */
> 
> So, without actually analyzing code flow, I think it is safe to say
> that sooner or later the array part will shrink.
> 

Got it, thanks. Looks like nil is better than false in this case.

Luther