Roberto Ierusalimschy 24 년 전
부모
커밋
8e9b1e4ae9
2개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 3 3
      lobject.h
  2. 4 4
      lua.c

+ 3 - 3
lobject.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.h,v 1.110 2001/08/27 15:16:28 roberto Exp $
+** $Id: lobject.h,v 1.112 2001/09/07 17:39:10 roberto Exp $
 ** Type definitions for Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -178,8 +178,8 @@ typedef struct UpVal {
 ** Closures
 */
 typedef struct Closure {
-  int isC;  /* 0 for Lua functions, 1 for C functions */
-  int nupvalues;
+  short isC;  /* 0 for Lua functions, 1 for C functions */
+  short nupvalues;
   struct Closure *next;
   struct Closure *mark;  /* marked closures (point to itself when not marked) */
   union {

+ 4 - 4
lua.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lua.c,v 1.68 2001/06/11 14:57:17 roberto Exp $
+** $Id: lua.c,v 1.69 2001/08/30 20:54:02 roberto Exp $
 ** Lua stand-alone interpreter
 ** See Copyright Notice in lua.h
 */
@@ -196,7 +196,7 @@ static void manual_input (int version, int prompt) {
       }
       if (firstline && buffer[0] == l_c('=')) {
         buffer[0] = l_c(' ');
-        lua_pushstring(L, l_s("return "));
+        lua_pushstring(L, l_s("return"));
         toprint = 1;
       }
       l = strlen(buffer);
@@ -212,8 +212,8 @@ static void manual_input (int version, int prompt) {
     }
     lua_concat(L, lua_gettop(L));
     ldo(lua_dostring, lua_tostring(L, 1), 0);
-    if (toprint) {
-      lua_remove(L, 1);  /* remove ran string */
+    lua_remove(L, 1);  /* remove ran string */
+    if (toprint && lua_gettop(L) > 0) {  /* any result to print? */
       lua_getglobal(L, l_s("print"));
       lua_insert(L, 1);
       lua_call(L, lua_gettop(L)-1, 0);