lua-users home
lua-l archive

Re: __index returns truncated to one, why?

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


On 11.04.2014 08:35, Thomas Jericke wrote:
On 04/11/2014 08:39 AM, duz wrote:
Hmm, after *you* wrote an __index method that returns two values, *you* are surprised it does?
Why do you assume that the person who wrote "foo(tracker[1]) " is the
same as the one who wrote __index for tracker?
I write a lot of functions used by others, for projects that are used
over years.
--
Thomas
What I mean is it takes a conscious decision to use that.
You would document it and it would serve a purpose like in my example.
Unless there are __index methods out there which return multiple
values already and the users are protected from them by Lua throwing
them away, nobody will be caught by surprise and harmed.

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