lua-users home
lua-l archive

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

On Monday, December 8, 2014, Luiz Henrique de Figueiredo <> wrote:
> If I'm understanding the manual correctly, lua_tolstring() doesn't
> honour __tostring. Similarly lua_tonumberx() doesn't call __tonumber
> (if such a metamethod even exists?). The manual also doesn't appear to
> specify whether lua_call() will look at __call.

All core metamethods are honored in the Lua API, except for those
functions that are named *raw*. Both the API functions and the VM
instructions ultimately use the same code. The core metamethods
are listed in .

__tostring is not a core metamethod, nor are __pairs and __ipairs.

So, lua_tolstring does not honor __tostring. luaL_tolstring does.

Neither is __call then, I take it? It is not honored in xpcall, at least.