/* Return the name of the type of an object. For tables and userdata with metatable, use their '__name' metafield, if present.  */
const char* luaT_objtypename(lua_State *L, const TValue *o)
/* Return the name of the type of an object. For tables and userdata with metatable, use their '__name' metafield, if present.  */
const char* luaT_objtypename(lua_State *L, const TValue *o)
{
    const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name"));
    if (ttisstring(name))
      return getstr(tsvalue(name));
  }
  return ttypename(ttype(o));
}