MCPcopy Create free account
hub / github.com/DFHack/dfhack / lua_getmetatable

Function lua_getmetatable

depends/lua/src/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 15

convert_to_exceptionFunction · 0.85
decode_matinfoFunction · 0.85
check_pen_nativeFunction · 0.85
dfhack_pen_indexFunction · 0.85
check_penarray_nativeFunction · 0.85
check_random_nativeFunction · 0.85
get_object_internalMethod · 0.85
IsDFObjectMethod · 0.85
get_object_identityMethod · 0.85
meta_ptr_compareFunction · 0.85
meta_displaceFunction · 0.85
meta_newFunction · 0.85

Calls 1

index2addrFunction · 0.85

Tested by

no test coverage detected