MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / lua_getmetatable

Function lua_getmetatable

lua/lapi.c:594–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 12

luaB_getmetatableFunction · 0.85
luaB_newproxyFunction · 0.85
l_typed_assignmentFunction · 0.85
luaL_checkudataFunction · 0.85
luaL_getmetafieldFunction · 0.85
get_sqlrow_stmtFunction · 0.85
db_get_event_tidFunction · 0.85
db_get_event_epochFunction · 0.85
db_get_event_sequenceFunction · 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