MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaL_getmetafield

Function luaL_getmetafield

3rd/lua-5.4.3/src/lauxlib.c:845–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

843
844
845LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
846 if (!lua_getmetatable(L, obj)) /* no metatable? */
847 return LUA_TNIL;
848 else {
849 int tt;
850 lua_pushstring(L, event);
851 tt = lua_rawget(L, -2);
852 if (tt == LUA_TNIL) /* is metafield nil? */
853 lua_pop(L, 2); /* remove metatable and metafield */
854 else
855 lua_remove(L, -2); /* remove only metatable */
856 return tt; /* return metafield type */
857 }
858}
859
860
861LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {

Callers 7

luaB_getmetatableFunction · 0.85
luaB_setmetatableFunction · 0.85
luaB_pairsFunction · 0.85
trymtFunction · 0.85
luaL_typeerrorFunction · 0.85
luaL_callmetaFunction · 0.85
luaL_tolstringFunction · 0.85

Calls 3

lua_getmetatableFunction · 0.85
lua_pushstringFunction · 0.85
lua_rawgetFunction · 0.85

Tested by

no test coverage detected