summaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-10-24 12:54:05 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-10-24 12:54:05 -0200
commitaf00a0772ca1a37f6d8cce5b6c03cc86db0389c3 (patch)
tree571699f16a48330ffd686ab97839dcdbb1d1449d /ldblib.c
parent6819c2a98adebaea1a8d1b065364f3b3748072aa (diff)
downloadlua-github-af00a0772ca1a37f6d8cce5b6c03cc86db0389c3.tar.gz
new functions lua_rawsetp/lua_rawgetp
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ldblib.c b/ldblib.c
index 571f9773..35c47f81 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldblib.c,v 1.129 2011/01/26 16:30:02 roberto Exp roberto $
+** $Id: ldblib.c,v 1.130 2011/04/08 19:17:36 roberto Exp roberto $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@@ -260,8 +260,7 @@ static void hookf (lua_State *L, lua_Debug *ar) {
static const char *const hooknames[] =
{"call", "return", "line", "count", "tail call"};
gethooktable(L);
- lua_pushlightuserdata(L, L);
- lua_rawget(L, -2);
+ lua_rawgetp(L, -1, L);
if (lua_isfunction(L, -1)) {
lua_pushstring(L, hooknames[(int)ar->event]);
if (ar->currentline >= 0)
@@ -308,9 +307,8 @@ static int db_sethook (lua_State *L) {
func = hookf; mask = makemask(smask, count);
}
gethooktable(L);
- lua_pushlightuserdata(L, L1);
lua_pushvalue(L, arg+1);
- lua_rawset(L, -3); /* set new hook */
+ lua_rawsetp(L, -2, L1); /* set new hook */
lua_pop(L, 1); /* remove hook table */
lua_sethook(L1, func, mask, count); /* set hooks */
return 0;
@@ -327,8 +325,7 @@ static int db_gethook (lua_State *L) {
lua_pushliteral(L, "external hook");
else {
gethooktable(L);
- lua_pushlightuserdata(L, L1);
- lua_rawget(L, -2); /* get hook */
+ lua_rawgetp(L, -1, L1); /* get hook */
lua_remove(L, -2); /* remove hook table */
}
lua_pushstring(L, unmakemask(mask, buff));