| 553 | |
| 554 | |
| 555 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
| 556 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
| 557 | return 0; |
| 558 | lua_pushstring(L, event); |
| 559 | lua_rawget(L, -2); |
| 560 | if (lua_isnil(L, -1)) { |
| 561 | lua_pop(L, 2); /* remove metatable and metafield */ |
| 562 | return 0; |
| 563 | } |
| 564 | else { |
| 565 | lua_remove(L, -2); /* remove only metatable */ |
| 566 | return 1; |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | |
| 571 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { |
no test coverage detected