[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Surprising behavior of table.insert()
- From: Patrick Donnelly <batrick@...>
- Date: Fri, 25 Feb 2011 16:06:21 -0500
On Fri, Feb 25, 2011 at 4:03 PM, Enrico Colombini <erix@erix.it> wrote:
> On 25/02/2011 21.35, Javier Guerra Giraldez wrote:
>>
>> if you return at most one value, just wrap your function call in
>> parenthesis.
>>
>> table.insert (t,(f()))
>
> Or, more explicitly, table.insert(t, f() or nil)
These are not the same. If f() returns false then yours incorrectly inserts nil.
--
- Patrick Donnelly