diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-31 11:10:24 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-31 11:10:24 -0200 |
| commit | 67c1afff5917b118f3be818dd0df7448d19de877 (patch) | |
| tree | 10b60153e85947af9a1791148b145e0dca82775d /ltm.c | |
| parent | 03770ecfc91718f7a208995adb1f9fd5d8e0c85e (diff) | |
| download | lua-67c1afff5917b118f3be818dd0df7448d19de877.tar.gz lua-67c1afff5917b118f3be818dd0df7448d19de877.tar.bz2 lua-67c1afff5917b118f3be818dd0df7448d19de877.zip | |
lua_settagmethod does not return old tag method
Diffstat (limited to 'ltm.c')
| -rw-r--r-- | ltm.c | 7 |
1 files changed, 2 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltm.c,v 1.54 2000/10/05 13:00:17 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.55 2000/10/20 16:39:03 roberto Exp roberto $ |
| 3 | ** Tag methods | 3 | ** Tag methods |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -141,7 +141,6 @@ LUA_API void lua_gettagmethod (lua_State *L, int t, const char *event) { | |||
| 141 | 141 | ||
| 142 | 142 | ||
| 143 | LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { | 143 | LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { |
| 144 | Closure *oldtm; | ||
| 145 | int e = luaI_checkevent(L, event, t); | 144 | int e = luaI_checkevent(L, event, t); |
| 146 | checktag(L, t); | 145 | checktag(L, t); |
| 147 | if (!luaT_validevent(t, e)) | 146 | if (!luaT_validevent(t, e)) |
| @@ -149,7 +148,6 @@ LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { | |||
| 149 | luaT_eventname[e], luaO_typenames[t], | 148 | luaT_eventname[e], luaO_typenames[t], |
| 150 | (t == LUA_TTABLE || t == LUA_TUSERDATA) ? | 149 | (t == LUA_TTABLE || t == LUA_TUSERDATA) ? |
| 151 | " with default tag" : ""); | 150 | " with default tag" : ""); |
| 152 | oldtm = luaT_gettm(L, t, e); | ||
| 153 | switch (ttype(L->top - 1)) { | 151 | switch (ttype(L->top - 1)) { |
| 154 | case LUA_TNIL: | 152 | case LUA_TNIL: |
| 155 | luaT_gettm(L, t, e) = NULL; | 153 | luaT_gettm(L, t, e) = NULL; |
| @@ -160,7 +158,6 @@ LUA_API void lua_settagmethod (lua_State *L, int t, const char *event) { | |||
| 160 | default: | 158 | default: |
| 161 | lua_error(L, "tag method must be a function (or nil)"); | 159 | lua_error(L, "tag method must be a function (or nil)"); |
| 162 | } | 160 | } |
| 163 | clvalue(L->top - 1) = oldtm; | 161 | L->top--; |
| 164 | ttype(L->top - 1) = (oldtm ? LUA_TFUNCTION : LUA_TNIL); | ||
| 165 | } | 162 | } |
| 166 | 163 | ||
