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

Function lua_getmetatable

other_src/lua/src/lapi.cpp:619–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617
618
619LUA_API int lua_getmetatable (lua_State *L, int objindex) {
620 const TValue *obj;
621 Table *mt = NULL;
622 int res;
623 lua_lock(L);
624 obj = index2adr(L, objindex);
625 switch (ttype(obj)) {
626 case LUA_TTABLE:
627 mt = hvalue(obj)->metatable;
628 break;
629 case LUA_TUSERDATA:
630 mt = uvalue(obj)->metatable;
631 break;
632 default:
633 mt = G(L)->mt[ttype(obj)];
634 break;
635 }
636 if (mt == NULL)
637 res = 0;
638 else {
639 sethvalue(L, L->top, mt);
640 api_incr_top(L);
641 res = 1;
642 }
643 lua_unlock(L);
644 return res;
645}
646
647
648LUA_API void lua_getfenv (lua_State *L, int idx) {

Callers 9

ll_seeallFunction · 0.70
testpatternFunction · 0.70
io_typeFunction · 0.70
luaL_checkudataFunction · 0.70
luaL_testudataFunction · 0.70
luaL_getmetafieldFunction · 0.70
db_getmetatableFunction · 0.70
luaB_getmetatableFunction · 0.70
luaB_newproxyFunction · 0.70

Calls 1

index2adrFunction · 0.70

Tested by

no test coverage detected