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 /inout.c | |
parent | 6d383202dca4535866a339f17202e40b2775d160 (diff) | |
download | lua-e5ec547eb36090bb884378a23743a60e4f9f8bb7.tar.gz lua-e5ec547eb36090bb884378a23743a60e4f9f8bb7.tar.bz2 lua-e5ec547eb36090bb884378a23743a60e4f9f8bb7.zip |
"call" returns separate results, instead of a table.
Diffstat (limited to 'inout.c')
-rw-r--r-- | inout.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -5,7 +5,7 @@ | |||
5 | ** Also provides some predefined lua functions. | 5 | ** Also provides some predefined lua functions. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | char *rcs_inout="$Id: inout.c,v 2.40 1996/09/11 21:53:02 roberto Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.41 1996/09/24 17:30:28 roberto Exp roberto $"; |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <string.h> | 11 | #include <string.h> |
@@ -281,15 +281,13 @@ void luaI_call (void) | |||
281 | temp = lua_getsubscript(); | 281 | temp = lua_getsubscript(); |
282 | narg = lua_isnumber(temp) ? lua_getnumber(temp) : MAXPARAMS+1; | 282 | narg = lua_isnumber(temp) ? lua_getnumber(temp) : MAXPARAMS+1; |
283 | /* read arg[1...n] */ | 283 | /* read arg[1...n] */ |
284 | for (i=0; i<narg; i++) | 284 | for (i=0; i<narg; i++) { |
285 | { | ||
286 | if (i>=MAXPARAMS) | 285 | if (i>=MAXPARAMS) |
287 | lua_error("argument list too long in function `call'"); | 286 | lua_error("argument list too long in function `call'"); |
288 | lua_pushobject(arg); | 287 | lua_pushobject(arg); |
289 | lua_pushnumber(i+1); | 288 | lua_pushnumber(i+1); |
290 | params[i] = lua_getsubscript(); | 289 | params[i] = lua_getsubscript(); |
291 | if (narg == MAXPARAMS+1 && lua_isnil(params[i])) | 290 | if (narg == MAXPARAMS+1 && lua_isnil(params[i])) { |
292 | { | ||
293 | narg = i; | 291 | narg = i; |
294 | break; | 292 | break; |
295 | } | 293 | } |
@@ -298,14 +296,7 @@ void luaI_call (void) | |||
298 | for (i=0; i<narg; i++) | 296 | for (i=0; i<narg; i++) |
299 | lua_pushobject(params[i]); | 297 | lua_pushobject(params[i]); |
300 | if (lua_callfunction(f)) | 298 | if (lua_callfunction(f)) |
301 | { /* error */ | ||
302 | lua_error(NULL); | 299 | lua_error(NULL); |
303 | } | ||
304 | else | 300 | else |
305 | { /* push results */ | 301 | passresults(); |
306 | Object r; | ||
307 | arg = lua_getresult(1); | ||
308 | luaI_packarg((arg == LUA_NOOBJECT)?NULL:luaI_Address(arg), &r); | ||
309 | luaI_pushobject(&r); | ||
310 | } | ||
311 | } | 302 | } |