[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua 5.3.0-rc3 - Possible imprecision in the manual.
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Sun, 04 Jan 2015 11:21:18 +0100
Hi All!
I think there is an imprecision in section 2.4 of the rc3 manual. The
7th paragraph reads (emphasis mine):
A detailed list of events controlled by metatables is given next. Each
operation is identified by its corresponding **event name**. The **key
for each event** is a string with **its name prefixed by two
underscores, '__'**; for instance, the key for operation "add" is the
string "__add". Note that queries for metamethods are always raw; the
access to a metamethod does not invoke other metamethods. You can
emulate how Lua queries a metamethod for an object obj with the
following code:
rawget(getmetatable(obj) or {}, event_name)
in this latter Lua code line the 2nd argument apparently refers to the
/name/ of the event, but it should refer to the associated /key/.
It could seem nitpicking, but the cited paragraph is very precise and
seem to stress the difference quite a bit. Therefore that 2nd argument
could confound the newbie reader, especially if he has paid due
attention to the previous lines.
Maybe /event_name/ should be replaced by /event_key/ or something similar.
Cheers!
-- Lorenzo
--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments