lua-users home
lua-l archive

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


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.