aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-08 17:49:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-08 17:49:05 -0300
commitbad6365540ad9e17e51137a6797ff196d6b8d2a1 (patch)
tree8d16d51f0c4167f59a879751660742ff28bf011f
parent91f34fb05caa9590cd19a986e865a93361b1c398 (diff)
downloadlua-bad6365540ad9e17e51137a6797ff196d6b8d2a1.tar.gz
lua-bad6365540ad9e17e51137a6797ff196d6b8d2a1.tar.bz2
lua-bad6365540ad9e17e51137a6797ff196d6b8d2a1.zip
details
-rw-r--r--lapi.c21
-rw-r--r--lapi.h3
-rw-r--r--ldebug.c4
3 files changed, 12 insertions, 16 deletions
diff --git a/lapi.c b/lapi.c
index 60a9b45c..95e4faba 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.78 2000/04/17 19:23:12 roberto Exp roberto $ 2** $Id: lapi.c,v 1.79 2000/05/08 19:32:53 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*/
@@ -44,13 +44,6 @@ lua_Object luaA_putluaObject (lua_State *L, const TObject *o) {
44} 44}
45 45
46 46
47lua_Object luaA_putObjectOnTop (lua_State *L) {
48 luaD_openstack(L, L->Cstack.base);
49 *L->Cstack.base++ = *(--L->top);
50 return L->Cstack.base-1;
51}
52
53
54static void top2LC (lua_State *L, int n) { 47static void top2LC (lua_State *L, int n) {
55 /* Put the `n' elements on the top as the Lua2C contents */ 48 /* Put the `n' elements on the top as the Lua2C contents */
56 L->Cstack.base = L->top; /* new base */ 49 L->Cstack.base = L->top; /* new base */
@@ -61,7 +54,11 @@ static void top2LC (lua_State *L, int n) {
61 54
62lua_Object lua_pop (lua_State *L) { 55lua_Object lua_pop (lua_State *L) {
63 luaA_checkCargs(L, 1); 56 luaA_checkCargs(L, 1);
64 return luaA_putObjectOnTop(L); 57 if (L->Cstack.base != L->top-1) {
58 luaD_openstack(L, L->Cstack.base);
59 *L->Cstack.base = *(--L->top);
60 }
61 return L->Cstack.base++;
65} 62}
66 63
67 64
@@ -112,14 +109,14 @@ lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) {
112 if ((ttype(method) != TAG_NIL) && (*lua_type(L, method) != 'f')) 109 if ((ttype(method) != TAG_NIL) && (*lua_type(L, method) != 'f'))
113 lua_error(L, "Lua API error - tag method must be a function or nil"); 110 lua_error(L, "Lua API error - tag method must be a function or nil");
114 luaT_settagmethod(L, tag, event, method); 111 luaT_settagmethod(L, tag, event, method);
115 return luaA_putObjectOnTop(L); 112 return lua_pop(L);
116} 113}
117 114
118 115
119lua_Object lua_gettable (lua_State *L) { 116lua_Object lua_gettable (lua_State *L) {
120 luaA_checkCargs(L, 2); 117 luaA_checkCargs(L, 2);
121 luaV_gettable(L, L->top--); 118 luaV_gettable(L, L->top--);
122 return luaA_putObjectOnTop(L); 119 return lua_pop(L);
123} 120}
124 121
125 122
@@ -163,7 +160,7 @@ lua_Object lua_createtable (lua_State *L) {
163 160
164lua_Object lua_getglobal (lua_State *L, const char *name) { 161lua_Object lua_getglobal (lua_State *L, const char *name) {
165 luaV_getglobal(L, luaS_new(L, name), L->top++); 162 luaV_getglobal(L, luaS_new(L, name), L->top++);
166 return luaA_putObjectOnTop(L); 163 return lua_pop(L);
167} 164}
168 165
169 166
diff --git a/lapi.h b/lapi.h
index ec0fa707..05153d6d 100644
--- a/lapi.h
+++ b/lapi.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.h,v 1.16 2000/03/29 20:19:20 roberto Exp roberto $ 2** $Id: lapi.h,v 1.17 2000/05/08 19:32:53 roberto Exp roberto $
3** Auxiliary functions from Lua API 3** Auxiliary functions from Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -15,6 +15,5 @@ void luaA_checkCargs (lua_State *L, int nargs);
15void luaA_pushobject (lua_State *L, const TObject *o); 15void luaA_pushobject (lua_State *L, const TObject *o);
16int luaA_next (lua_State *L, const Hash *t, int i); 16int luaA_next (lua_State *L, const Hash *t, int i);
17lua_Object luaA_putluaObject (lua_State *L, const TObject *o); 17lua_Object luaA_putluaObject (lua_State *L, const TObject *o);
18lua_Object luaA_putObjectOnTop (lua_State *L);
19 18
20#endif 19#endif
diff --git a/ldebug.c b/ldebug.c
index 3a381455..d3eadab8 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.16 2000/03/30 20:55:50 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.17 2000/05/08 19:32:53 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -197,7 +197,7 @@ int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
197 case 'f': 197 case 'f':
198 setnormalized(L->top, func); 198 setnormalized(L->top, func);
199 incr_top; 199 incr_top;
200 ar->func = luaA_putObjectOnTop(L); 200 ar->func = lua_pop(L);
201 break; 201 break;
202 default: return 0; /* invalid option */ 202 default: return 0; /* invalid option */
203 } 203 }