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

Function lua_getmetatable

source/extern/lua/lapi.c:697–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

695
696
697LUA_API int lua_getmetatable (lua_State *L, int objindex) {
698 const TValue *obj;
699 Table *mt;
700 int res = 0;
701 lua_lock(L);
702 obj = index2addr(L, objindex);
703 switch (ttnov(obj)) {
704 case LUA_TTABLE:
705 mt = hvalue(obj)->metatable;
706 break;
707 case LUA_TUSERDATA:
708 mt = uvalue(obj)->metatable;
709 break;
710 default:
711 mt = G(L)->mt[ttnov(obj)];
712 break;
713 }
714 if (mt != NULL) {
715 sethvalue(L, L->top, mt);
716 api_incr_top(L);
717 res = 1;
718 }
719 lua_unlock(L);
720 return res;
721}
722
723
724LUA_API int lua_getuservalue (lua_State *L, int idx) {

Callers 10

luaB_getmetatableFunction · 0.85
luaL_testudataFunction · 0.85
luaL_getmetafieldFunction · 0.85
checktabFunction · 0.85
ll_seeallFunction · 0.85
db_getmetatableFunction · 0.85
tableGetMetatableMethod · 0.85
popLuaValueMethod · 0.85
userDataIsTypeMethod · 0.85
getUserDataMethod · 0.85

Calls 1

index2addrFunction · 0.85

Tested by

no test coverage detected