aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-05-26 13:09:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2011-05-26 13:09:40 -0300
commitee7d0c26493e1303a06f45b28ee2822c5a6aff05 (patch)
tree86781476f7f308055fc6340440fad855d2ae8601 /lbaselib.c
parentaa13c591f59f55ea31c14fcc554f8fc96dff67c2 (diff)
downloadlua-ee7d0c26493e1303a06f45b28ee2822c5a6aff05.tar.gz
lua-ee7d0c26493e1303a06f45b28ee2822c5a6aff05.tar.bz2
lua-ee7d0c26493e1303a06f45b28ee2822c5a6aff05.zip
new macro 'luai_writeline' to print newlines (and flush 'stdout')
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 67edd96e..eb06df4e 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.259 2011/01/26 16:30:02 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.260 2011/02/28 17:32:10 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -32,13 +32,13 @@ static int luaB_print (lua_State *L) {
32 lua_call(L, 1, 1); 32 lua_call(L, 1, 1);
33 s = lua_tolstring(L, -1, &l); /* get result */ 33 s = lua_tolstring(L, -1, &l); /* get result */
34 if (s == NULL) 34 if (s == NULL)
35 return luaL_error(L, LUA_QL("tostring") " must return a string to " 35 return luaL_error(L,
36 LUA_QL("print")); 36 LUA_QL("tostring") " must return a string to " LUA_QL("print"));
37 if (i>1) luai_writestring("\t", 1); 37 if (i>1) luai_writestring("\t", 1);
38 luai_writestring(s, l); 38 luai_writestring(s, l);
39 lua_pop(L, 1); /* pop result */ 39 lua_pop(L, 1); /* pop result */
40 } 40 }
41 luai_writestring("\n", 1); 41 luai_writeline();
42 return 0; 42 return 0;
43} 43}
44 44