summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-20 14:57:42 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-20 14:57:42 -0200
commitb7ffb128cb63a1315e11b8e9490164654a1048ff (patch)
tree8c722d330421e1def2f42557ddc28b9e8424f8c2
parent64eecc0b8219cc3bcaa2b717826a4376c60d9305 (diff)
downloadlua-github-b7ffb128cb63a1315e11b8e9490164654a1048ff.tar.gz
it is unsafe to allow Lua to get gc tag methods
-rw-r--r--lbaselib.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lbaselib.c b/lbaselib.c
index b32d07af..c27c7c01 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.11 2000/10/09 15:46:43 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.12 2000/10/20 16:39:03 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -179,7 +179,7 @@ static int luaB_rawset (lua_State *L) {
}
static int luaB_settagmethod (lua_State *L) {
- int tag = (int)luaL_check_int(L, 1);
+ int tag = luaL_check_int(L, 1);
const char *event = luaL_check_string(L, 2);
luaL_arg_check(L, lua_isfunction(L, 3) || lua_isnil(L, 3), 3,
"function or nil expected");
@@ -190,7 +190,11 @@ static int luaB_settagmethod (lua_State *L) {
}
static int luaB_gettagmethod (lua_State *L) {
- lua_gettagmethod(L, luaL_check_int(L, 1), luaL_check_string(L, 2));
+ int tag = luaL_check_int(L, 1);
+ const char *event = luaL_check_string(L, 2);
+ if (strcmp(event, "gc") == 0)
+ lua_error(L, "deprecated use: cannot get the `gc' tag method from Lua");
+ lua_gettagmethod(L, tag, event);
return 1;
}