| 697 | |
| 698 | |
| 699 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
| 700 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
| 701 | return 0; |
| 702 | lua_pushstring(L, event); |
| 703 | lua_rawget(L, -2); |
| 704 | if (lua_isnil(L, -1)) { |
| 705 | lua_pop(L, 2); /* remove metatable and metafield */ |
| 706 | return 0; |
| 707 | } |
| 708 | else { |
| 709 | lua_remove(L, -2); /* remove only metatable */ |
| 710 | return 1; |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | |
| 715 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { |
no test coverage detected