lua-users home
lua-l archive

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


Eitherway you should never "insert nil" into a list, if i recall
correctly, the behavior is undefined depending on the array/hash state
of table.

On Fri, Feb 25, 2011 at 10:06 PM, Patrick Donnelly <batrick@batbytes.com> wrote:
> 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
>
>