lua-users home
lua-l archive

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

On Mar 24, 2014, at 9:32 PM, Dirk Laurie <> wrote:

> 2014-03-25 5:13 GMT+02:00 Andrew Starks <>:
>> I also agree that ".." should always call __tostring, even on (especially) tables.
> I don't agree. Lua should "not know what to do" so that a metamethod will be
> looked for. Otherwise we can chuck away the __concat metamethod.

I agree, and your example highlights the deeper difference between operator metamethods and coercion metamethods. I’d hate to see Lua ending up as messy as C++ where figuring out which function was called involves looking at templates, signatures, automatic casts etc etc .. (shudders).

I think __tostring() should get invoked ONLY when tostring() is explicitly called.