[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Trailing nils in an argument list (Was: Definition of table.insert)
- From: Dirk Laurie <dpl@...>
- Date: Sun, 9 Jan 2011 17:48:40 +0200
On Sun, Jan 09, 2011 at 04:51:00PM +0200, David Kastrup wrote:
> Dirk Laurie <email@example.com> writes:
> > 6. insert(a,b) does not do the same as insert(a,b,nil). This
> > behaviour would not be possible for a function of three arguments
> > written in Lua itself.
> function arity(...)
> return select('#',...)
> 2 3
By 'a function of three arguments' I mean a function starting with e.g.
No such function can give distinguish whether it is called as f(1,2)
rather than f(1,2,nil).
But I concede your point. You don't need C to write a Lua function
that can make that distinction.