| 226 | |
| 227 | |
| 228 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
| 229 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
| 230 | return 0; |
| 231 | lua_pushstring(L, event); |
| 232 | lua_rawget(L, -2); |
| 233 | if (lua_isnil(L, -1)) { |
| 234 | lua_pop(L, 2); /* remove metatable and metafield */ |
| 235 | return 0; |
| 236 | } |
| 237 | else { |
| 238 | lua_remove(L, -2); /* remove only metatable */ |
| 239 | return 1; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | |
| 244 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { |
no test coverage detected