[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work2) now available
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 14 Jan 2010 19:14:00 -0200
> __len is still able to return non number values. What is the position
> about that? Is that the desired behaviour?
__len can return any Lua value:
for k,v in ipairs({true,print,"hello",{},io.stdin}) do
a=setmetatable({},{__len=function() return v end})
print(k,v,#a)
end
1 true true
2 function: 0x9bbdfd0 function: 0x9bbdfd0
3 hello hello
4 table: 0x9bc2240 table: 0x9bc2240
5 file (0x2e5420) file (0x2e5420)