summaryrefslogtreecommitdiff
path: root/inout.c
diff options
context:
space:
mode:
Diffstat (limited to 'inout.c')
-rw-r--r--inout.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/inout.c b/inout.c
index c77ed649..e0df3359 100644
--- a/inout.c
+++ b/inout.c
@@ -5,7 +5,7 @@
5** Also provides some predefined lua functions. 5** Also provides some predefined lua functions.
6*/ 6*/
7 7
8char *rcs_inout="$Id: inout.c,v 2.39 1996/09/09 14:11:11 roberto Exp roberto $"; 8char *rcs_inout="$Id: inout.c,v 2.40 1996/09/11 21:53:02 roberto Exp roberto $";
9 9
10#include <stdio.h> 10#include <stdio.h>
11#include <string.h> 11#include <string.h>
@@ -111,15 +111,25 @@ static void check_arg (int cond, char *func)
111 } 111 }
112} 112}
113 113
114
115static int passresults (void)
116{
117 int arg = 0;
118 lua_Object obj;
119 while ((obj = lua_getresult(++arg)) != LUA_NOOBJECT)
120 lua_pushobject(obj);
121 return arg-1;
122}
114 123
115/* 124/*
116** Internal function: do a string 125** Internal function: do a string
117*/ 126*/
118void lua_internaldostring (void) 127void lua_internaldostring (void)
119{ 128{
120 lua_Object obj = lua_getparam (1); 129 lua_Object obj = lua_getparam (1);
121 if (lua_isstring(obj) && !lua_dostring(lua_getstring(obj))) 130 if (lua_isstring(obj) && lua_dostring(lua_getstring(obj)) == 0)
122 lua_pushnumber(1); 131 if (passresults() == 0)
132 lua_pushuserdata(NULL); /* at least one result to signal no errors */
123} 133}
124 134
125/* 135/*
@@ -134,8 +144,9 @@ void lua_internaldofile (void)
134 else if (obj != LUA_NOOBJECT) 144 else if (obj != LUA_NOOBJECT)
135 lua_error("invalid argument to function `dofile'"); 145 lua_error("invalid argument to function `dofile'");
136 /* else fname = NULL */ 146 /* else fname = NULL */
137 if (!lua_dofile(fname)) 147 if (lua_dofile(fname) == 0)
138 lua_pushnumber(1); 148 if (passresults() == 0)
149 lua_pushuserdata(NULL); /* at least one result to signal no errors */
139} 150}
140 151
141 152