lua-users home
lua-l archive

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


Adrian Sietsma wrote:
> I note that #{nil,1,2,3} returns 4, in Lua 5.1. This behavior is highly
> desirable, but contradicts the 5.1 documentation re #. Can this
> behaviour be relied upon (otherwise unpack({...}) would lose embedded
> nils) ?

No; by using an array with a nil in it, you're breaking the rules, and
you're open for all kinds of undefined behaviour.

I believe this also applies to unpack({...}), assuming that ... is
syntactic and not shorthand for 'insert stuff here'. If the ... expands to
a tuple containing a nil, Bad Stuff will happen.

-- 
+- David Given --McQ-+ "If you're up against someone more intelligent
|  dg@cowlark.com    | than you are, do something insane and let him think
| (dg@tao-group.com) | himself to death." --- Pyanfar Chanur
+- www.cowlark.com --+