commit a1700bbc5022efc4ecb16d57f2ffb0afaed78bf4
parent 8876a1bf92bd4b3e2e04eca2aed198a0135d9282
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 23 May 2002 16:42:42 -0300
details
Diffstat:
M | lua.c | | | 18 | +++++++++--------- |
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lua.c b/lua.c
@@ -1,5 +1,5 @@
/*
-** $Id: lua.c,v 1.86 2002/05/15 18:57:44 roberto Exp roberto $
+** $Id: lua.c,v 1.87 2002/05/16 19:09:19 roberto Exp roberto $
** Lua stand-alone interpreter
** See Copyright Notice in lua.h
*/
@@ -67,8 +67,7 @@ static void laction (int i) {
static void report (int status) {
- if (status == 0) return;
- else {
+ if (status) {
lua_getglobal(L, "_ALERT");
lua_pushvalue(L, -2);
lua_pcall(L, 1, 0, 0);
@@ -151,19 +150,20 @@ static int l_getargs (lua_State *l) {
}
-static int file_input (const char *name) {
- int status = lua_loadfile(L, name);
+static int docall (int status) {
if (status == 0) status = lcall(1);
report(status);
return status;
}
+static int file_input (const char *name) {
+ return docall(lua_loadfile(L, name));
+}
+
+
static int dostring (const char *s, const char *name) {
- int status = lua_loadbuffer(L, s, strlen(s), name);
- if (status == 0) status = lcall(1);
- report(status);
- return status;
+ return docall(lua_loadbuffer(L, s, strlen(s), name));
}