MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / lua_getmetatable

Function lua_getmetatable

deps/lua/src/lapi.c:587–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585
586
587LUA_API int lua_getmetatable (lua_State *L, int objindex) {
588 const TValue *obj;
589 Table *mt = NULL;
590 int res;
591 lua_lock(L);
592 obj = index2adr(L, objindex);
593 switch (ttype(obj)) {
594 case LUA_TTABLE:
595 mt = hvalue(obj)->metatable;
596 break;
597 case LUA_TUSERDATA:
598 mt = uvalue(obj)->metatable;
599 break;
600 default:
601 mt = G(L)->mt[ttype(obj)];
602 break;
603 }
604 if (mt == NULL)
605 res = 0;
606 else {
607 sethvalue(L, L->top, mt);
608 api_incr_top(L);
609 res = 1;
610 }
611 lua_unlock(L);
612 return res;
613}
614
615
616LUA_API void lua_getfenv (lua_State *L, int idx) {

Callers 7

luaB_getmetatableFunction · 0.85
luaB_newproxyFunction · 0.85
luaL_checkudataFunction · 0.85
luaL_getmetafieldFunction · 0.85
ll_seeallFunction · 0.85
io_typeFunction · 0.85
db_getmetatableFunction · 0.85

Calls 1

index2adrFunction · 0.85

Tested by

no test coverage detected