diff --git a/inout.c b/inout.c index c77ed649..e0df3359 100644 --- a/inout.c +++ b/inout.c @@ -5,7 +5,7 @@ ** Also provides some predefined lua functions. */ -char *rcs_inout="$Id: inout.c,v 2.39 1996/09/09 14:11:11 roberto Exp roberto $"; +char *rcs_inout="$Id: inout.c,v 2.40 1996/09/11 21:53:02 roberto Exp roberto $"; #include #include @@ -111,15 +111,25 @@ static void check_arg (int cond, char *func) } } + +static int passresults (void) +{ + int arg = 0; + lua_Object obj; + while ((obj = lua_getresult(++arg)) != LUA_NOOBJECT) + lua_pushobject(obj); + return arg-1; +} /* ** Internal function: do a string */ void lua_internaldostring (void) { - lua_Object obj = lua_getparam (1); - if (lua_isstring(obj) && !lua_dostring(lua_getstring(obj))) - lua_pushnumber(1); + lua_Object obj = lua_getparam (1); + if (lua_isstring(obj) && lua_dostring(lua_getstring(obj)) == 0) + if (passresults() == 0) + lua_pushuserdata(NULL); /* at least one result to signal no errors */ } /* @@ -134,8 +144,9 @@ void lua_internaldofile (void) else if (obj != LUA_NOOBJECT) lua_error("invalid argument to function `dofile'"); /* else fname = NULL */ - if (!lua_dofile(fname)) - lua_pushnumber(1); + if (lua_dofile(fname) == 0) + if (passresults() == 0) + lua_pushuserdata(NULL); /* at least one result to signal no errors */ } diff --git a/lua.c b/lua.c index a58e87ad..d5622d86 100644 --- a/lua.c +++ b/lua.c @@ -3,7 +3,7 @@ ** Linguagem para Usuarios de Aplicacao */ -char *rcs_lua="$Id: lua.c,v 1.12 1996/07/05 20:55:43 roberto Exp roberto $"; +char *rcs_lua="$Id: lua.c,v 1.13 1996/07/06 20:20:35 roberto Exp roberto $"; #include #include @@ -21,11 +21,13 @@ char *rcs_lua="$Id: lua.c,v 1.12 1996/07/05 20:55:43 roberto Exp roberto $"; static void manual_input (void) { - if (isatty(0)) - { - char buffer[250]; - while (fgets(buffer, sizeof(buffer), stdin) != 0) - lua_dostring(buffer); + if (isatty(0)) { + char buffer[250]; + while (fgets(buffer, sizeof(buffer), stdin) != 0) { + lua_beginblock(); + lua_dostring(buffer); + lua_endblock(); + } } else lua_dofile(NULL); /* executes stdin as a file */ diff --git a/opcode.c b/opcode.c index 7af5d125..93efbab2 100644 --- a/opcode.c +++ b/opcode.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 3.73 1996/09/02 21:57:51 roberto Exp roberto $"; +char *rcs_opcode="$Id: opcode.c,v 3.74 1996/09/20 12:51:16 roberto Exp roberto $"; #include #include @@ -481,8 +481,7 @@ int luaI_dorun (TFunc *tf) adjustC(1); /* one slot for the pseudo-function */ stack[CLS_current.base].tag = LUA_T_FUNCTION; stack[CLS_current.base].value.tf = tf; - status = do_protectedrun(0); - adjustC(0); + status = do_protectedrun(MULT_RET); return status; }