lua-users home
lua-l archive

Re: [ANN] Lua 5.3.4 (rc3) now available

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


On 2017年01月25日 04:21, Dirk Laurie wrote:
> It is an undocumented feature, though. The manual says:
> 
> (The entry __name is used by some error-reporting functions.)
> 
> tostring() is not an error-reporting function.
> 
> Maybe the manual could merely say:
> 
> (The entry __name is used by some reporting functions.)
It may also be a good idea to mention it in more places than just one
spot deep in the C API... or move the description elsewhere.
One solution: At the end of §2.4 (Metatables and Metamethods), add
something roughly like:
= Because metatables are regular tables, they can contain arbitrary
= fields, not only the event names defined above. Some functions in
= the standard library (e.g., `tostring`) use other fields in metatables
= for their own purposes.
+ As an example, some functions use `__name` as a more specific type
+ name. If present, it influences some error messages and the output
+ of `luaL_tolstring` and `tostring`.
(And the parenthetical remark on error messages at luaL_newmetatable can
be removed.)
(IIRC there were a bunch of other things you only get from the C API
sections. Standalone interpreter-only users who don't "speak" C are
unlikely to read those as it's mostly incomprehensible gibberish for
them. I had a list somewhere but can't find it right now. =/)
-- nobody

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