MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / lua_getmetatable

Function lua_getmetatable

Source/Misc/lua/src/lua.c:2436–2462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2434
2435
2436LUA_API int lua_getmetatable (lua_State *L, int objindex) {
2437const TValue *obj;
2438Table *mt = NULL;
2439int res;
2440lua_lock(L);
2441obj = index2adr(L, objindex);
2442switch (ttype(obj)) {
2443case LUA_TTABLE:
2444mt = hvalue(obj)->metatable;
2445break;
2446case LUA_TUSERDATA:
2447mt = uvalue(obj)->metatable;
2448break;
2449default:
2450mt = G(L)->mt[ttype(obj)];
2451break;
2452}
2453if (mt == NULL)
2454res = 0;
2455else {
2456sethvalue(L, L->top, mt);
2457api_incr_top(L);
2458res = 1;
2459}
2460lua_unlock(L);
2461return res;
2462}
2463
2464
2465LUA_API void lua_getfenv (lua_State *L, int idx) {

Callers 15

luausb_generic_indexFunction · 0.85
luausb_generic_newindexFunction · 0.85
luausb_generic_tostringFunction · 0.85
luausb_is_interfaceFunction · 0.85
luausb_is_deviceFunction · 0.85
luausb_is_device_handleFunction · 0.85
luausb_is_transferFunction · 0.85
is_class_repMethod · 0.85

Calls 1

index2adrFunction · 0.85

Tested by

no test coverage detected