[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) now available
- From: Patrick Rapin <toupie300@...>
- Date: Tue, 14 Jun 2011 16:43:26 +0200
Isn't the following a bug ?
> return getmetatable(string).__call
stdin:1: no field '__call' in strings
stack traceback:
[C]: in function '__index'
stdin:1: in main chunk
[C]: in ?
In previous versions of Lua, getmetatable(string) returns nil (which is valid).
Now `string` seems to have a metatable, but which doesn't support
indexing of unknown metamethods.
This is a problem because for testing if a value is callable I used to
write the following:
if type(v) == 'function' or (getmetatable(v) or {}).__call then end
but now this fails for the `string` global table.
- References:
- [ANN] Lua 5.2.0 (beta-rc1) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Xavier Wang
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Petite Abeille
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, steve donovan
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, David Given
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, steve donovan
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Tomas Guisasola Gorham
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Mike Pall