lua-users home
lua-l archive

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


On Mon, Dec 8, 2014 at 5:20 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> 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.
>

Interesting. Why is __tostring not a core metamethod? The distinction
seems arbitrary to me.

As an aside, I notice the changes section in the 5.3 manual doesn't
list functions that were newly added, such as lua_geti. I think
listing new functions would be very helpful to keep people like me
from requesting things without noticing they were already added. :-)

-- 
Sent from my Game Boy.