[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua life after integers
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 10 Dec 2014 23:29:35 +0200
2014-12-10 18:24 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
> On Wed, Dec 10, 2014 at 8:52 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> 2014-12-10 16:44 GMT+02:00 Rena <hyperhacker@gmail.com>:
>>
>>> 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
({'principles','prejudices'})[math.random(2)].