| 201 | |
| 202 | |
| 203 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
| 204 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
| 205 | return 0; |
| 206 | lua_pushstring(L, event); |
| 207 | lua_rawget(L, -2); |
| 208 | if (lua_isnil(L, -1)) { |
| 209 | lua_pop(L, 2); /* remove metatable and metafield */ |
| 210 | return 0; |
| 211 | } |
| 212 | else { |
| 213 | lua_remove(L, -2); /* remove only metatable */ |
| 214 | return 1; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | |
| 219 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { |
no test coverage detected