diff --git a/lbaselib.c b/lbaselib.c index 67edd96e..eb06df4e 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.259 2011/01/26 16:30:02 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.260 2011/02/28 17:32:10 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -32,13 +32,13 @@ static int luaB_print (lua_State *L) { lua_call(L, 1, 1); s = lua_tolstring(L, -1, &l); /* get result */ if (s == NULL) - return luaL_error(L, LUA_QL("tostring") " must return a string to " - LUA_QL("print")); + return luaL_error(L, + LUA_QL("tostring") " must return a string to " LUA_QL("print")); if (i>1) luai_writestring("\t", 1); luai_writestring(s, l); lua_pop(L, 1); /* pop result */ } - luai_writestring("\n", 1); + luai_writeline(); return 0; } diff --git a/lua.c b/lua.c index 46783fc2..5b582824 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.197 2011/03/14 15:39:42 roberto Exp roberto $ +** $Id: lua.c,v 1.198 2011/05/03 16:01:57 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -183,7 +183,8 @@ static int docall (lua_State *L, int narg, int nres) { static void print_version (void) { - luai_writestring(LUA_COPYRIGHT "\n", sizeof(LUA_COPYRIGHT) + 1); + luai_writestring(LUA_COPYRIGHT, sizeof(LUA_COPYRIGHT)); + luai_writeline(); } @@ -320,7 +321,7 @@ static void dotty (lua_State *L) { } } lua_settop(L, 0); /* clear stack */ - luai_writestring("\n", 1); + luai_writeline(); progname = oldprogname; } diff --git a/luaconf.h b/luaconf.h index f95f93f9..202655ba 100644 --- a/luaconf.h +++ b/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.156 2011/04/20 18:25:54 roberto Exp roberto $ +** $Id: luaconf.h,v 1.157 2011/04/29 13:56:28 roberto Exp roberto $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -209,10 +209,11 @@ /* -@@ luai_writestring defines how 'print' prints its results. +@@ luai_writestring/luai_writeline define how 'print' prints its results. */ #include #define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) /* @@ luai_writestringerror defines how to print error messages.