diff options
-rw-r--r-- | lapi.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.65 1999/12/23 18:19:57 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.66 1999/12/27 17:33:22 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -119,8 +119,12 @@ lua_Object lua_gettagmethod (lua_State *L, int tag, const char *event) { | |||
119 | 119 | ||
120 | 120 | ||
121 | lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) { | 121 | lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) { |
122 | TObject *method; | ||
122 | luaA_checkCparams(L, 1); | 123 | luaA_checkCparams(L, 1); |
123 | luaT_settagmethod(L, tag, event, L->top-1); | 124 | method = L->top-1; |
125 | if ((ttype(method) != LUA_T_NIL) && (*lua_type(L, method) != 'f')) | ||
126 | lua_error(L, "API error - tag method must be a function or nil"); | ||
127 | luaT_settagmethod(L, tag, event, method); | ||
124 | return luaA_putObjectOnTop(L); | 128 | return luaA_putObjectOnTop(L); |
125 | } | 129 | } |
126 | 130 | ||