MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / lua_getmetatable

Function lua_getmetatable

xrepo/packages/l/lua/port/lua/src/lapi.c:779–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777
778
779LUA_API int lua_getmetatable (lua_State *L, int objindex) {
780 const TValue *obj;
781 Table *mt;
782 int res = 0;
783 lua_lock(L);
784 obj = index2value(L, objindex);
785 switch (ttype(obj)) {
786 case LUA_TTABLE:
787 mt = hvalue(obj)->metatable;
788 break;
789 case LUA_TUSERDATA:
790 mt = uvalue(obj)->metatable;
791 break;
792 default:
793 mt = G(L)->mt[ttype(obj)];
794 break;
795 }
796 if (mt != NULL) {
797 sethvalue2s(L, L->top, mt);
798 api_incr_top(L);
799 res = 1;
800 }
801 lua_unlock(L);
802 return res;
803}
804
805
806LUA_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
luaL_testudataFunction · 0.50
skr_check_unknownFunction · 0.50

Calls 1

index2valueFunction · 0.85

Tested by

no test coverage detected