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

Function luaL_getmetafield

depends/lua/src/lauxlib.c:772–785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770
771
772LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
773 if (!lua_getmetatable(L, obj)) /* no metatable? */
774 return LUA_TNIL;
775 else {
776 int tt;
777 lua_pushstring(L, event);
778 tt = lua_rawget(L, -2);
779 if (tt == LUA_TNIL) /* is metafield nil? */
780 lua_pop(L, 2); /* remove metatable and metafield */
781 else
782 lua_remove(L, -2); /* remove only metatable */
783 return tt; /* return metafield type */
784 }
785}
786
787
788LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {

Callers 6

luaB_getmetatableFunction · 0.85
luaB_setmetatableFunction · 0.85
pairsmetaFunction · 0.85
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