[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Defensive Programming with Arrays (was Re: Speed of #t)
- From: Javier Guerra Giraldez <javier@...>
- Date: Mon, 13 Dec 2010 12:36:24 -0500
On Mon, Dec 13, 2010 at 12:23 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> local append = table.insert
> local T = {}
> for _,o in ipairs(names) do
> append(T,find_object(name))
> end
>
> find_object() may return nil, which is a standard Lua way of saying
> 'sorry chum no can do', and the fun begins.
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 :-)
--
Javier