diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-09-24 18:46:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-09-24 18:46:44 -0300 |
commit | e5ec547eb36090bb884378a23743a60e4f9f8bb7 (patch) | |
tree | c9bcba8846caae9c89cce8884d9e2eea426b7500 /opcode.c | |
parent | 6d383202dca4535866a339f17202e40b2775d160 (diff) | |
download | lua-github-e5ec547eb36090bb884378a23743a60e4f9f8bb7.tar.gz |
"call" returns separate results, instead of a table.
Diffstat (limited to 'opcode.c')
-rw-r--r-- | opcode.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 3.74 1996/09/20 12:51:16 roberto Exp roberto $"; +char *rcs_opcode="$Id: opcode.c,v 3.75 1996/09/24 17:30:28 roberto Exp roberto $"; #include <setjmp.h> #include <stdio.h> @@ -897,41 +897,35 @@ static void comparison (lua_Type tag_less, lua_Type tag_equal, } -void luaI_packarg (Object *firstelem, Object *arg) +static void adjust_varargs (StkId first_extra_arg) { - int nvararg = (firstelem != NULL) ? top-firstelem : 0; + Object arg; + Object *firstelem = stack+first_extra_arg; + int nvararg = top-firstelem; int i; if (nvararg < 0) nvararg = 0; - avalue(arg) = lua_createarray(nvararg+1); /* +1 for field 'n' */ - tag(arg) = LUA_T_ARRAY; - for (i=0; i<nvararg; i++) - { + avalue(&arg) = lua_createarray(nvararg+1); /* +1 for field 'n' */ + tag(&arg) = LUA_T_ARRAY; + for (i=0; i<nvararg; i++) { Object index; tag(&index) = LUA_T_NUMBER; nvalue(&index) = i+1; - *(lua_hashdefine(avalue(arg), &index)) = *(firstelem+i); + *(lua_hashdefine(avalue(&arg), &index)) = *(firstelem+i); } - /* store counter in field "n" */ - { + /* store counter in field "n" */ { Object index, extra; tag(&index) = LUA_T_STRING; tsvalue(&index) = lua_createstring("n"); tag(&extra) = LUA_T_NUMBER; nvalue(&extra) = nvararg; - *(lua_hashdefine(avalue(arg), &index)) = extra; + *(lua_hashdefine(avalue(&arg), &index)) = extra; } -} - - -static void adjust_varargs (StkId first_extra_arg) -{ - Object arg; - luaI_packarg(stack+first_extra_arg, &arg); adjust_top(first_extra_arg); *top = arg; incr_top; } + /* ** Execute the given opcode, until a RET. Parameters are between ** [stack+base,top). Returns n such that the the results are between |