diff options
-rw-r--r-- | lbaselib.c | 21 | ||||
-rw-r--r-- | luaconf.h | 9 |
2 files changed, 12 insertions, 18 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.208 2008/07/11 17:51:01 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.209 2009/02/06 18:38:47 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 | */ |
@@ -19,19 +19,6 @@ | |||
19 | #include "lualib.h" | 19 | #include "lualib.h" |
20 | 20 | ||
21 | 21 | ||
22 | |||
23 | |||
24 | /* | ||
25 | ** If your system does not support `stdout', you can just remove this function. | ||
26 | ** If you need, you can define your own `print' function, following this | ||
27 | ** model but changing `writestring' to put the strings at a proper place | ||
28 | ** (a console window or a log file, for instance). | ||
29 | */ | ||
30 | static void writestring (const char *s, size_t l) { | ||
31 | fwrite(s, sizeof(char), l, stdout); | ||
32 | } | ||
33 | |||
34 | |||
35 | static int luaB_print (lua_State *L) { | 22 | static int luaB_print (lua_State *L) { |
36 | int n = lua_gettop(L); /* number of arguments */ | 23 | int n = lua_gettop(L); /* number of arguments */ |
37 | int i; | 24 | int i; |
@@ -46,11 +33,11 @@ static int luaB_print (lua_State *L) { | |||
46 | if (s == NULL) | 33 | if (s == NULL) |
47 | return luaL_error(L, LUA_QL("tostring") " must return a string to " | 34 | return luaL_error(L, LUA_QL("tostring") " must return a string to " |
48 | LUA_QL("print")); | 35 | LUA_QL("print")); |
49 | if (i>1) writestring("\t", 1); | 36 | if (i>1) luai_writestring("\t", 1); |
50 | writestring(s, l); | 37 | luai_writestring(s, l); |
51 | lua_pop(L, 1); /* pop result */ | 38 | lua_pop(L, 1); /* pop result */ |
52 | } | 39 | } |
53 | writestring("\n", 1); | 40 | luai_writestring("\n", 1); |
54 | return 0; | 41 | return 0; |
55 | } | 42 | } |
56 | 43 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.99 2008/07/11 17:50:31 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.100 2008/07/18 19:58:10 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -221,6 +221,13 @@ | |||
221 | 221 | ||
222 | 222 | ||
223 | /* | 223 | /* |
224 | @@ luai_writestring defines how 'print' prints its results. | ||
225 | ** CHANGE it if your system does not have a useful stdout. | ||
226 | */ | ||
227 | #define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) | ||
228 | |||
229 | |||
230 | /* | ||
224 | ** {================================================================== | 231 | ** {================================================================== |
225 | ** Stand-alone configuration | 232 | ** Stand-alone configuration |
226 | ** =================================================================== | 233 | ** =================================================================== |