[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua life after integers
- From: Andrew Starks <andrew.starks@...>
- Date: Mon, 8 Dec 2014 18:00:29 -0600
On Monday, December 8, 2014, Luiz Henrique de Figueiredo <firstname.lastname@example.org> 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 http://www.lua.org/work/doc/manual.html#2.4 .
__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.