summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-08-26 09:04:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-08-26 09:04:13 -0300
commitb1141427991dea7a96597f2aacdedf243b60decd (patch)
tree28a56414da88099502ae7d182b44e5201856c787 /ldo.c
parent4b2e71ddb674c3bb22f549743721155ddaeb9b5d (diff)
downloadlua-b1141427991dea7a96597f2aacdedf243b60decd.tar.gz
lua-b1141427991dea7a96597f2aacdedf243b60decd.tar.bz2
lua-b1141427991dea7a96597f2aacdedf243b60decd.zip
new auxiliary function `luaH_setstr'
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ldo.c b/ldo.c
index c6fd0b59..2b5dfdbf 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.221 2003/07/16 20:51:47 roberto Exp roberto $ 2** $Id: ldo.c,v 1.222 2003/08/25 19:51:54 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*/
@@ -198,7 +198,6 @@ void luaD_callhook (lua_State *L, int event, int line) {
198static void adjust_varargs (lua_State *L, int nfixargs, StkId base) { 198static void adjust_varargs (lua_State *L, int nfixargs, StkId base) {
199 int i; 199 int i;
200 Table *htab; 200 Table *htab;
201 TObject nname;
202 int actual = L->top - base; /* actual number of arguments */ 201 int actual = L->top - base; /* actual number of arguments */
203 if (actual < nfixargs) { 202 if (actual < nfixargs) {
204 luaD_checkstack(L, nfixargs - actual); 203 luaD_checkstack(L, nfixargs - actual);
@@ -210,8 +209,8 @@ static void adjust_varargs (lua_State *L, int nfixargs, StkId base) {
210 for (i=0; i<actual; i++) /* put extra arguments into `arg' table */ 209 for (i=0; i<actual; i++) /* put extra arguments into `arg' table */
211 setobj2n(luaH_setnum(L, htab, i+1), L->top - actual + i); 210 setobj2n(luaH_setnum(L, htab, i+1), L->top - actual + i);
212 /* store counter in field `n' */ 211 /* store counter in field `n' */
213 setsvalue(&nname, luaS_newliteral(L, "n")); 212 setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")),
214 setnvalue(luaH_set(L, htab, &nname), cast(lua_Number, actual)); 213 cast(lua_Number, actual));
215 L->top -= actual; /* remove extra elements from the stack */ 214 L->top -= actual; /* remove extra elements from the stack */
216 sethvalue(L->top, htab); 215 sethvalue(L->top, htab);
217 incr_top(L); 216 incr_top(L);