[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Glitch in __len metamethod for full userdata?
- From: Dirk Feytons <dirk.feytons@...>
- Date: Thu, 7 Jan 2010 09:58:00 +0100
On Wed, Jan 6, 2010 at 10:36 PM, Michael Roth <firstname.lastname@example.org> wrote:
> I came across a small documentation or maybe implementation glitch:
> The documentation at http://www.lua.org/manual/5.1/manual.html#2.8 states,
> that the #-operator will eventually call the __len metamethod with
> But at least for userdata with a metatable and a __len metamethod, the call in
> reality is:
> h(op, nil)
> I came across this issue because I employed an assert(lua_top(L)==1) in my
> code... Not a big issue... But maybe someone interested in?
This has been mentioned before. The same thing happens (more or less)
for an __unm metamethod. It's considered an "implementation detail"
(see http://lua-users.org/lists/lua-l/2007-07/msg00587.html) although
I'm not sure that's equally applicable to __len.