aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-27 17:35:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-27 17:35:40 -0300
commit46c471d7e97292d923721655683affd7e8b314de (patch)
treec9ae53cc94b1cca209fd5af7f594d355d6c111a9 /ldo.c
parent859ecf36b6f96a5a0961f09c00cd98088081384c (diff)
downloadlua-46c471d7e97292d923721655683affd7e8b314de.tar.gz
lua-46c471d7e97292d923721655683affd7e8b314de.tar.bz2
lua-46c471d7e97292d923721655683affd7e8b314de.zip
new `__newindex' eventfield
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ldo.c b/ldo.c
index 34914923..c11c5639 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.175 2002/05/15 18:57:44 roberto Exp roberto $ 2** $Id: ldo.c,v 1.176 2002/05/16 18:39:46 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -171,7 +171,7 @@ static void luaD_callHook (lua_State *L, lua_Hook callhook, const char *event) {
171static void adjust_varargs (lua_State *L, int nfixargs) { 171static void adjust_varargs (lua_State *L, int nfixargs) {
172 int i; 172 int i;
173 Table *htab; 173 Table *htab;
174 TObject n, nname; 174 TObject nname;
175 int actual = L->top - L->ci->base; /* actual number of arguments */ 175 int actual = L->top - L->ci->base; /* actual number of arguments */
176 if (actual < nfixargs) { 176 if (actual < nfixargs) {
177 luaD_checkstack(L, nfixargs - actual); 177 luaD_checkstack(L, nfixargs - actual);
@@ -181,11 +181,10 @@ static void adjust_varargs (lua_State *L, int nfixargs) {
181 actual -= nfixargs; /* number of extra arguments */ 181 actual -= nfixargs; /* number of extra arguments */
182 htab = luaH_new(L, 0, 0); /* create `arg' table */ 182 htab = luaH_new(L, 0, 0); /* create `arg' table */
183 for (i=0; i<actual; i++) /* put extra arguments into `arg' table */ 183 for (i=0; i<actual; i++) /* put extra arguments into `arg' table */
184 luaH_setnum(L, htab, i+1, L->top - actual + i); 184 setobj(luaH_setnum(L, htab, i+1), L->top - actual + i);
185 /* store counter in field `n' */ 185 /* store counter in field `n' */
186 setnvalue(&n, actual);
187 setsvalue(&nname, luaS_newliteral(L, "n")); 186 setsvalue(&nname, luaS_newliteral(L, "n"));
188 luaH_set(L, htab, &nname, &n); 187 setnvalue(luaH_set(L, htab, &nname), actual);
189 L->top -= actual; /* remove extra elements from the stack */ 188 L->top -= actual; /* remove extra elements from the stack */
190 sethvalue(L->top, htab); 189 sethvalue(L->top, htab);
191 incr_top(L); 190 incr_top(L);