MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaT_objtypename

Function luaT_objtypename

extlibs/lua/src/ltm.c:91–100  ·  view source on GitHub ↗

** Return the name of the type of an object. For tables and userdata ** with metatable, use their '__name' metafield, if present. */

Source from the content-addressed store, hash-verified

89** with metatable, use their '__name' metafield, if present.
90*/
91const char *luaT_objtypename (lua_State *L, const TValue *o) {
92 Table *mt;
93 if ((ttistable(o) && (mt = hvalue(o)->metatable) != NULL) ||
94 (ttisfulluserdata(o) && (mt = uvalue(o)->metatable) != NULL)) {
95 const TValue *name = luaH_getshortstr(mt, luaS_new(L, "__name"));
96 if (ttisstring(name)) /* is '__name' a string? */
97 return getstr(tsvalue(name)); /* use it as type name */
98 }
99 return ttypename(ttype(o)); /* else use standard type name */
100}
101
102
103void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,

Callers 3

luaG_typeerrorFunction · 0.85
luaG_forerrorFunction · 0.85
luaG_ordererrorFunction · 0.85

Calls 2

luaH_getshortstrFunction · 0.85
luaS_newFunction · 0.85

Tested by

no test coverage detected