MCPcopy Create free account
hub / github.com/SOUI2/soui / lua_getmetatable

Function lua_getmetatable

third-part/lua-52/src/lapi.c:686–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684
685
686LUA_API int lua_getmetatable (lua_State *L, int objindex) {
687 const TValue *obj;
688 Table *mt = NULL;
689 int res;
690 lua_lock(L);
691 obj = index2addr(L, objindex);
692 switch (ttypenv(obj)) {
693 case LUA_TTABLE:
694 mt = hvalue(obj)->metatable;
695 break;
696 case LUA_TUSERDATA:
697 mt = uvalue(obj)->metatable;
698 break;
699 default:
700 mt = G(L)->mt[ttypenv(obj)];
701 break;
702 }
703 if (mt == NULL)
704 res = 0;
705 else {
706 sethvalue(L, L->top, mt);
707 api_incr_top(L);
708 res = 1;
709 }
710 lua_unlock(L);
711 return res;
712}
713
714
715LUA_API void lua_getuservalue (lua_State *L, int idx) {

Callers 7

meta_getMethod · 0.85
meta_setMethod · 0.85
luaB_getmetatableFunction · 0.85
luaL_testudataFunction · 0.85
luaL_getmetafieldFunction · 0.85
ll_seeallFunction · 0.85
db_getmetatableFunction · 0.85

Calls 2

index2addrFunction · 0.85
GClass · 0.85

Tested by

no test coverage detected