lua-users home
lua-l archive

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

2014-12-10 18:24 GMT+02:00 Andrew Starks <>:

> On Wed, Dec 10, 2014 at 8:52 AM, Dirk Laurie <> wrote:
>> 2014-12-10 16:44 GMT+02:00 Rena <>:
>>> Interesting. Why is __tostring not a core metamethod? The distinction
>>> seems arbitrary to me.
>> A core metamethod is a fallback. It is called when Lua does not
>> know what to do, as a last resort instead of throwing an error.
>> __tostring, __pairs etc are called _instead_ of what Lua knows
>> to do.
> I don't make that distinction, even when I'm reminded that the authors do.

Understanding what the authors do and why they do it is in
the long run more productive than sticking with one's