[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua-5.1-alpha: length operator on tables (arrays) and nil values
- From: Michael Roth <mroth@...>
- Date: Wed, 14 Sep 2005 00:58:18 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Luiz Henrique de Figueiredo wrote:
>>How to handle nil arguments in vararg functions?
>
>
> Nil args are handled fine. The exact number of args passed to a vararg
> function is the result of select('#',...).
Ah, ok. Looks nice. Btw:
function pack(...)
return arg
end
t = pack()
print(t.n) ---> "0"
Is the arg.n field inside vararg functions by design?
So the "only" problem left is that arrays with holes are not smart and I
have to handle the array length myself?
As I seen, unpack() can handle explicit sized arrays now.
cu
Michael
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDJ1mJSIrOxc3jOmoRAugeAKCWzMwzcEhmHt4yCe9jwaZGPjDtFQCeI6d0
KXZFId9TDLkALQCAHowwGDU=
=SAbZ
-----END PGP SIGNATURE-----