[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: passing vararg to xpcall?
- From: PA <petite.abeille@...>
- Date: Thu, 23 Feb 2006 21:01:56 +0100
On Feb 23, 2006, at 20:38, David Given wrote:
On Thursday 23 February 2006 19:29, PA wrote:
[...]
Yes.. but in practice... how could you tell the difference between a
trailing nil and a nonexistent nil?
Because in an argument list, you can spot 'em with arg.n, or whatever
mechanism 5.1 has to replace this (I forget exactly). This is one of
the
places where tables and tuples are different.
Ok... so... for the sake of completeness... how would you capture the
length of a table with trailing nil in plain Lua 5.1?
function test()
return 1, nil, 2, nil
end
local someResults = { test() }
print( "#", #someResults )
print( "maxn", table.maxn( someResults ) )
> # 1
> maxn 3
How would one get the "proper" length of 4? The length operator gives
1. table.maxn() gives 3. Who gives 4?
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/