MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / lua_getmetatable

Function lua_getmetatable

lib/lua/src/lapi.c:775–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773
774
775LUA_API int lua_getmetatable (lua_State *L, int objindex) {
776 const TValue *obj;
777 Table *mt;
778 int res = 0;
779 lua_lock(L);
780 obj = index2value(L, objindex);
781 switch (ttype(obj)) {
782 case LUA_TTABLE:
783 mt = hvalue(obj)->metatable;
784 break;
785 case LUA_TUSERDATA:
786 mt = uvalue(obj)->metatable;
787 break;
788 default:
789 mt = G(L)->mt[ttype(obj)];
790 break;
791 }
792 if (mt != NULL) {
793 sethvalue2s(L, L->top.p, mt);
794 api_incr_top(L);
795 res = 1;
796 }
797 lua_unlock(L);
798 return res;
799}
800
801
802LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) {

Callers 5

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

Calls 2

index2valueFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected