[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A little bit about nothing (was Re: Empty? No. Array? No. Has? Yes.)
- From: Finn Wilcox <finnw@...>
- Date: Wed, 03 Jul 2013 17:45:21 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/07/2013 17:20, Sean Conner wrote:
>
> In straight Lua, there is no way for something to know if it was
> called like:
>
> something()
>
> or
>
> something(nil)
>
Yes there is:
function something(...)
local mary = ...
return mary, select('#', ...) >= 1
end
> =something()
nil false
> =something(nil)
nil true
> =something(1)
1 true
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJR1FUgAAoJEHp3pOlF38H/vj8H/imbJCG+x8gPTcMxCxXzdoOa
LUpbW8fQcYiumfLnR9Yl+OdUeq/5smHUW1Cei47eC6u3LbN+xBP9aUmMDNCgGtow
jij+0bRr9G6DKjy1NiJsabdbitoL2S4QmFh+HlfraNjrDEVUdqoWgfrwhXEmOzzV
XP0IGhBWPC9IkOOkukfTk56tyPwDGG+B0Qn3Um1/D7mPqHW/VdZX2IBp20EO58FG
BaPwopPMWIRQV7tSZnuP5eG7zM+rTw68tc9k63xQzdy/h1TYvgFns15KlICLfdOa
MxR40qHr04zhF1tCeD7uhOUlwYy+uOh7roxvcynHrVcRk48b0R9ecur58fqQ/20=
=R0VO
-----END PGP SIGNATURE-----