lua-users home
lua-l archive

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


> Instead of `luaL_typename`, it would be nice to use __name.
> (questionable untested code ahead):
> 
>     default:
>       if (luaL_getmetafield(L, idx, "__name") == LUA_TSTRING) {
>         lua_pushfstring(L, "%s: %p", lua_tostring(L, -1),
> lua_topointer(L, idx));
>         lua_remove(L, lua_absindex(L, -2));
>       } else {
>         lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
> lua_topointer(L, idx));
>       }
>       break;

Small bug: if __name is defined but it is not a string, its value
won't be popped.

-- Roberto