diff options
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.109 2001/02/23 17:28:12 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.110 2001/03/06 20:09:38 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -11,6 +11,7 @@ | |||
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <time.h> | 12 | #include <time.h> |
13 | 13 | ||
14 | #define LUA_PRIVATE | ||
14 | #include "lua.h" | 15 | #include "lua.h" |
15 | 16 | ||
16 | #include "lauxlib.h" | 17 | #include "lauxlib.h" |
@@ -353,9 +354,10 @@ static int io_write (lua_State *L) { | |||
353 | int arg; | 354 | int arg; |
354 | int status = 1; | 355 | int status = 1; |
355 | for (arg=1; arg<=nargs; arg++) { | 356 | for (arg=1; arg<=nargs; arg++) { |
356 | if (lua_type(L, arg) == LUA_TNUMBER) { /* LUA_NUMBER */ | 357 | if (lua_type(L, arg) == LUA_TNUMBER) { |
357 | /* optimization: could be done exactly as for strings */ | 358 | /* optimization: could be done exactly as for strings */ |
358 | status = status && fprintf(f, l_s("%.16g"), lua_tonumber(L, arg)) > 0; | 359 | status = status && |
360 | fprintf(f, l_s(LUA_NUMBER_FMT), lua_tonumber(L, arg)) > 0; | ||
359 | } | 361 | } |
360 | else { | 362 | else { |
361 | size_t l; | 363 | size_t l; |
@@ -638,7 +640,7 @@ static int errorfb (lua_State *L) { | |||
638 | luaL_addstring(&b, l_s("\n")); | 640 | luaL_addstring(&b, l_s("\n")); |
639 | } | 641 | } |
640 | luaL_pushresult(&b); | 642 | luaL_pushresult(&b); |
641 | lua_getglobal(L, LUA_ALERT); | 643 | lua_getglobal(L, l_s(LUA_ALERT)); |
642 | if (lua_isfunction(L, -1)) { /* avoid loop if _ALERT is not defined */ | 644 | if (lua_isfunction(L, -1)) { /* avoid loop if _ALERT is not defined */ |
643 | lua_pushvalue(L, -2); /* error message */ | 645 | lua_pushvalue(L, -2); /* error message */ |
644 | lua_rawcall(L, 1, 0); | 646 | lua_rawcall(L, 1, 0); |
@@ -671,7 +673,7 @@ static const luaL_reg iolib[] = { | |||
671 | {l_s("tmpname"), io_tmpname}, | 673 | {l_s("tmpname"), io_tmpname}, |
672 | {l_s("write"), io_write}, | 674 | {l_s("write"), io_write}, |
673 | {l_s("writeto"), io_writeto}, | 675 | {l_s("writeto"), io_writeto}, |
674 | {LUA_ERRORMESSAGE, errorfb} | 676 | {l_s(LUA_ERRORMESSAGE), errorfb} |
675 | }; | 677 | }; |
676 | 678 | ||
677 | 679 | ||