MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_getmetatable

Function lua_getmetatable

third-party/lua-5.5.0/src/lapi.c:805–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

803
804
805LUA_API int lua_getmetatable (lua_State *L, int objindex) {
806 const TValue *obj;
807 Table *mt;
808 int res = 0;
809 lua_lock(L);
810 obj = index2value(L, objindex);
811 switch (ttype(obj)) {
812 case LUA_TTABLE:
813 mt = hvalue(obj)->metatable;
814 break;
815 case LUA_TUSERDATA:
816 mt = uvalue(obj)->metatable;
817 break;
818 default:
819 mt = G(L)->mt[ttype(obj)];
820 break;
821 }
822 if (mt != NULL) {
823 sethvalue2s(L, L->top.p, mt);
824 api_incr_top(L);
825 res = 1;
826 }
827 lua_unlock(L);
828 return res;
829}
830
831
832LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) {

Callers 7

luaB_getmetatableFunction · 0.70
luaL_testudataFunction · 0.70
luaL_getmetafieldFunction · 0.70
checktabFunction · 0.70
db_getmetatableFunction · 0.70
CallMetaFunctionFunction · 0.50
GetVariableMethod · 0.50

Calls 1

index2valueFunction · 0.70

Tested by

no test coverage detected