lua-users home
lua-l archive

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


On Thu, Dec 31, 2009 at 3:44 PM, Leo Razoumov <slonik.az@gmail.com> wrote:
> I wish that "map" would convert nil to false before pushing it into
> resultant array so that it becomes {10, false, 20, false} avoiding
> holes and preserving the length.

So 'false' becomes a way to represent holes? But I don't see why it is
crucial to preserve length of the result. Also, even if in principle
the result is all of one type, it ends up in general as a mixture of
booleans and that type.  There could be another operation which will
explicitly remove all occurances of a value, so my desired result is
something like map(strs,tonumber):remove_values(false)

steve d.