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

Function lua_getmetatable

extlibs/lua/src/lapi.c:734–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732
733
734LUA_API int lua_getmetatable (lua_State *L, int objindex) {
735 const TValue *obj;
736 Table *mt;
737 int res = 0;
738 lua_lock(L);
739 obj = index2value(L, objindex);
740 switch (ttype(obj)) {
741 case LUA_TTABLE:
742 mt = hvalue(obj)->metatable;
743 break;
744 case LUA_TUSERDATA:
745 mt = uvalue(obj)->metatable;
746 break;
747 default:
748 mt = G(L)->mt[ttype(obj)];
749 break;
750 }
751 if (mt != NULL) {
752 sethvalue2s(L, L->top, mt);
753 api_incr_top(L);
754 res = 1;
755 }
756 lua_unlock(L);
757 return res;
758}
759
760
761LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) {

Callers 14

luaB_getmetatableFunction · 0.85
luaL_testudataFunction · 0.85
luaL_getmetafieldFunction · 0.85
checktabFunction · 0.85
db_getmetatableFunction · 0.85
luaL_testudataFunction · 0.85
associated_type_nameFunction · 0.85
checkMethod · 0.85
checkMethod · 0.85
get_no_lua_nil_fromMethod · 0.85
getMethod · 0.85
index_failFunction · 0.85

Calls 1

index2valueFunction · 0.85

Tested by

no test coverage detected