aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-07 16:13:49 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-07 16:13:49 -0200
commit7178a5e34aa56c09a01a6664bb7a61c6771700d4 (patch)
tree318a1dd14cd5a0497229183e56e29198b3b2016c /lapi.c
parent322b7b5fc55da0d166efc693cfe674220190b010 (diff)
downloadlua-7178a5e34aa56c09a01a6664bb7a61c6771700d4.tar.gz
lua-7178a5e34aa56c09a01a6664bb7a61c6771700d4.tar.bz2
lua-7178a5e34aa56c09a01a6664bb7a61c6771700d4.zip
new way to handle top x L->top
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lapi.c b/lapi.c
index 387f7a21..e58fe789 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.124 2001/02/01 16:03:38 roberto Exp roberto $ 2** $Id: lapi.c,v 1.125 2001/02/02 15:13:05 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*/
@@ -208,7 +208,7 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) {
208 o1 = luaA_indexAcceptable(L, index1); 208 o1 = luaA_indexAcceptable(L, index1);
209 o2 = luaA_indexAcceptable(L, index2); 209 o2 = luaA_indexAcceptable(L, index2);
210 i = (o1 == NULL || o2 == NULL) ? 0 /* index out-of-range */ 210 i = (o1 == NULL || o2 == NULL) ? 0 /* index out-of-range */
211 : luaV_lessthan(L, o1, o2, L->top); 211 : luaV_lessthan(L, o1, o2);
212 LUA_UNLOCK(L); 212 LUA_UNLOCK(L);
213 return i; 213 return i;
214} 214}
@@ -364,7 +364,7 @@ LUA_API void lua_gettable (lua_State *L, int index) {
364 StkId t; 364 StkId t;
365 LUA_LOCK(L); 365 LUA_LOCK(L);
366 t = Index(L, index); 366 t = Index(L, index);
367 luaV_gettable(L, t, L->top, L->top-1); 367 luaV_gettable(L, t, L->top-1, L->top-1);
368 LUA_UNLOCK(L); 368 LUA_UNLOCK(L);
369} 369}
370 370
@@ -433,7 +433,7 @@ LUA_API void lua_newtable (lua_State *L) {
433 433
434LUA_API void lua_setglobal (lua_State *L, const char *name) { 434LUA_API void lua_setglobal (lua_State *L, const char *name) {
435 LUA_LOCK(L); 435 LUA_LOCK(L);
436 luaV_setglobal(L, luaS_new(L, name), L->top); 436 luaV_setglobal(L, luaS_new(L, name), L->top - 1);
437 L->top--; /* remove element from the top */ 437 L->top--; /* remove element from the top */
438 LUA_UNLOCK(L); 438 LUA_UNLOCK(L);
439} 439}
@@ -443,7 +443,7 @@ LUA_API void lua_settable (lua_State *L, int index) {
443 StkId t; 443 StkId t;
444 LUA_LOCK(L); 444 LUA_LOCK(L);
445 t = Index(L, index); 445 t = Index(L, index);
446 luaV_settable(L, t, L->top - 2, L->top); 446 luaV_settable(L, t, L->top - 2, L->top - 1);
447 L->top -= 2; /* pop index and value */ 447 L->top -= 2; /* pop index and value */
448 LUA_UNLOCK(L); 448 LUA_UNLOCK(L);
449} 449}