aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-10-17 19:12:57 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-10-17 19:12:57 -0200
commit1e81da51bab87148981486a84b846399050f4ef2 (patch)
treed2c94326ca096e032d1ae3fa75a5d0605f494cc6 /ltests.c
parent7cd37142f404462634a5049a840f572e85c5762b (diff)
downloadlua-1e81da51bab87148981486a84b846399050f4ef2.tar.gz
lua-1e81da51bab87148981486a84b846399050f4ef2.tar.bz2
lua-1e81da51bab87148981486a84b846399050f4ef2.zip
new API for registry and C upvalues + new implementation for references
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/ltests.c b/ltests.c
index 03d65657..afcc460a 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.91 2001/09/07 17:39:10 roberto Exp $ 2** $Id: ltests.c,v 1.92 2001/10/02 16:45:03 roberto Exp $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -317,21 +317,16 @@ static int tref (lua_State *L) {
317 int level = lua_gettop(L); 317 int level = lua_gettop(L);
318 luaL_checkany(L, 1); 318 luaL_checkany(L, 1);
319 lua_pushvalue(L, 1); 319 lua_pushvalue(L, 1);
320 lua_pushnumber(L, lua_ref(L, luaL_opt_int(L, 2, 1))); 320 lua_pushnumber(L, lua_ref(L, 1));
321 assert(lua_gettop(L) == level+1); /* +1 for result */ 321 assert(lua_gettop(L) == level+1); /* +1 for result */
322 return 1; 322 return 1;
323} 323}
324 324
325static int getref (lua_State *L) { 325static int getref (lua_State *L) {
326 int level = lua_gettop(L); 326 int level = lua_gettop(L);
327 if (lua_getref(L, luaL_check_int(L, 1))) { 327 lua_getref(L, luaL_check_int(L, 1));
328 assert(lua_gettop(L) == level+1); 328 assert(lua_gettop(L) == level+1);
329 return 1; 329 return 1;
330 }
331 else {
332 assert(lua_gettop(L) == level);
333 return 0;
334 }
335} 330}
336 331
337static int unref (lua_State *L) { 332static int unref (lua_State *L) {
@@ -570,6 +565,12 @@ static int testC (lua_State *L) {
570 else if EQ(l_s("pushvalue")) { 565 else if EQ(l_s("pushvalue")) {
571 lua_pushvalue(L, getnum); 566 lua_pushvalue(L, getnum);
572 } 567 }
568 else if EQ(l_s("pushcclosure")) {
569 lua_pushcclosure(L, testC, getnum);
570 }
571 else if EQ(l_s("pushupvalues")) {
572 lua_pushupvalues(L);
573 }
573 else if EQ(l_s("remove")) { 574 else if EQ(l_s("remove")) {
574 lua_remove(L, getnum); 575 lua_remove(L, getnum);
575 } 576 }