MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_getmetatable

Function lua_getmetatable

src/Chain/libraries/glua/lapi.cpp:699–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

checktabFunction · 0.85
ll_seeallFunction · 0.85
luaL_testudataFunction · 0.85
luaL_getmetafieldFunction · 0.85
db_getmetatableFunction · 0.85
luaB_getmetatableFunction · 0.85

Calls 1

index2addrFunction · 0.85

Tested by

no test coverage detected