diff options
-rw-r--r-- | lauxlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.153 2005/10/03 14:36:45 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.154 2005/10/19 13:05:11 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -199,7 +199,8 @@ LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, | |||
199 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { | 199 | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { |
200 | if (!lua_getmetatable(L, obj)) /* no metatable? */ | 200 | if (!lua_getmetatable(L, obj)) /* no metatable? */ |
201 | return 0; | 201 | return 0; |
202 | lua_getfield(L, -1, event); | 202 | lua_pushstring(L, event); |
203 | lua_rawget(L, -2); | ||
203 | if (lua_isnil(L, -1)) { | 204 | if (lua_isnil(L, -1)) { |
204 | lua_pop(L, 2); /* remove metatable and metafield */ | 205 | lua_pop(L, 2); /* remove metatable and metafield */ |
205 | return 0; | 206 | return 0; |