lua-users home
lua-l archive

Re: [ANN] Lua 5.2.0 (beta-rc3) now available

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


What if, say, a new string method gets added in the future and I want to write something like this:
 local newstrm = string.newmethod or special_fallback
It seems a bit silly to force that code to use rawget, just for the sake of a slightly different error for a specific kind of typo. (Couldn't the special error metamethod just be added exclusively to the string type metatable and not the library metatable?) On 2011年6月27日 15:48:57 -0400, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> =string.abc
stdin:1: no field 'abc' in strings
stack traceback:
 [C]: in function '__index'
 stdin:1: in main chunk
 [C]: in ?
Wouldn't it be better to return nil rather than raise an error?
http://lua-users.org/lists/lua-l/2011-06/msg00629.html
--> http://lua-users.org/lists/lua-l/2011-06/msg00718.html
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /