| 249 | |
| 250 | |
| 251 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
| 252 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
| 253 | return 0; |
| 254 | lua_pushstring(L, event); |
| 255 | lua_rawget(L, -2); |
| 256 | if (lua_isnil(L, -1)) { |
| 257 | lua_pop(L, 2); /* remove metatable and metafield */ |
| 258 | return 0; |
| 259 | } |
| 260 | else { |
| 261 | lua_remove(L, -2); /* remove only metatable */ |
| 262 | return 1; |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | |
| 267 | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { |
no test coverage detected