diff options
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -92,10 +92,9 @@ const char *luaT_objtypename (lua_State *L, const TValue *o) { | |||
92 | Table *mt; | 92 | Table *mt; |
93 | if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || | 93 | if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) || |
94 | (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { | 94 | (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) { |
95 | TValue name; | 95 | const TValue *name = luaH_Hgetshortstr(mt, luaS_new(L, "__name")); |
96 | int hres = luaH_getshortstr(mt, luaS_new(L, "__name"), &name); | 96 | if (ttisstring(name)) /* is '__name' a string? */ |
97 | if (hres == HOK && ttisstring(&name)) /* is '__name' a string? */ | 97 | return getstr(tsvalue(name)); /* use it as type name */ |
98 | return getstr(tsvalue(&name)); /* use it as type name */ | ||
99 | } | 98 | } |
100 | return ttypename(ttype(o)); /* else use standard type name */ | 99 | return ttypename(ttype(o)); /* else use standard type name */ |
101 | } | 100 | } |