lua-users home
lua-l archive

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


On Mon, Dec 13, 2010 at 7:36 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> is there any undesired effect to table.insert(t,nil) when t is a
> well-formed array?  after all, it's inserting nil at the end,  leaving
> the table unchanged and therefore still holeless  :-)

Sometimes we even rely on table.insert(t,nil) being a no-op.

The problem is that a map is supposed to take an array of N elements
and transform it into another array of N elements  (unless you allow
it to 'filter' as well, which seems sneaky.)

   t1 = map(fun,t2)

But this doesn't necessarily imply #t1 == #t2 if the for-loop was
numeric (most efficient method of mapping). Ah, the fun of holes!

steve d.