MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_getmetatable

Function lua_getmetatable

third-party/lua-5.3.5/src/lapi.c:697–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

695
696
697LUA_API int lua_getmetatable (lua_State *L, int objindex) {
698 const TValue *obj;
699 Table *mt;
700 int res = 0;
701 lua_lock(L);
702 obj = index2addr(L, objindex);
703 switch (ttnov(obj)) {
704 case LUA_TTABLE:
705 mt = hvalue(obj)->metatable;
706 break;
707 case LUA_TUSERDATA:
708 mt = uvalue(obj)->metatable;
709 break;
710 default:
711 mt = G(L)->mt[ttnov(obj)];
712 break;
713 }
714 if (mt != NULL) {
715 sethvalue(L, L->top, mt);
716 api_incr_top(L);
717 res = 1;
718 }
719 lua_unlock(L);
720 return res;
721}
722
723
724LUA_API int lua_getuservalue (lua_State *L, int idx) {

Callers 6

luaB_getmetatableFunction · 0.70
luaL_testudataFunction · 0.70
luaL_getmetafieldFunction · 0.70
checktabFunction · 0.70
ll_seeallFunction · 0.70
db_getmetatableFunction · 0.70

Calls 1

index2addrFunction · 0.70

Tested by

no test coverage detected