diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-29 11:41:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-29 11:41:56 -0300 |
| commit | 4e56c0d51412817a238f9de6453aaa16704a770d (patch) | |
| tree | 0a73178d345df961f32cf167dc6a92a5813ab6ed /lbuiltin.c | |
| parent | ac12f4db4b2f715b1556722b6ed65804cfd6348a (diff) | |
| download | lua-4e56c0d51412817a238f9de6453aaa16704a770d.tar.gz lua-4e56c0d51412817a238f9de6453aaa16704a770d.tar.bz2 lua-4e56c0d51412817a238f9de6453aaa16704a770d.zip | |
better implementation for luaV_pack
Diffstat (limited to 'lbuiltin.c')
| -rw-r--r-- | lbuiltin.c | 8 |
1 files changed, 3 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbuiltin.c,v 1.122 2000/08/28 17:57:04 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.123 2000/08/29 14:33:31 roberto Exp roberto $ |
| 3 | ** Built-in functions | 3 | ** Built-in functions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -333,7 +333,6 @@ int luaB_call (lua_State *L) { | |||
| 333 | for (i=0; i<n; i++) | 333 | for (i=0; i<n; i++) |
| 334 | *(L->top++) = *luaH_getnum(arg, i+1); | 334 | *(L->top++) = *luaH_getnum(arg, i+1); |
| 335 | status = lua_call(L, n, LUA_MULTRET); | 335 | status = lua_call(L, n, LUA_MULTRET); |
| 336 | n = lua_gettop(L) - oldtop; /* number of results */ | ||
| 337 | if (err != 0) { /* restore old error method */ | 336 | if (err != 0) { /* restore old error method */ |
| 338 | lua_pushobject(L, err); | 337 | lua_pushobject(L, err); |
| 339 | lua_setglobal(L, LUA_ERRORMESSAGE); | 338 | lua_setglobal(L, LUA_ERRORMESSAGE); |
| @@ -347,12 +346,11 @@ int luaB_call (lua_State *L) { | |||
| 347 | } | 346 | } |
| 348 | else { /* no errors */ | 347 | else { /* no errors */ |
| 349 | if (strchr(options, 'p')) { /* pack results? */ | 348 | if (strchr(options, 'p')) { /* pack results? */ |
| 350 | luaV_pack(L, luaA_index(L, oldtop+1), n, L->top); | 349 | luaV_pack(L, luaA_index(L, oldtop+1)); |
| 351 | incr_top; | ||
| 352 | return 1; /* only table is returned */ | 350 | return 1; /* only table is returned */ |
| 353 | } | 351 | } |
| 354 | else | 352 | else |
| 355 | return n; /* results are already on the stack */ | 353 | return lua_gettop(L) - oldtop; /* results are already on the stack */ |
| 356 | } | 354 | } |
| 357 | } | 355 | } |
| 358 | 356 | ||
