From dd3a63c205a97339d8c8aec3cd49941bc10ba45c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 26 Mar 2001 11:31:49 -0300 Subject: new way to handle `profiles' --- liolib.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index e1703ba7..d20fd12b 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 1.109 2001/02/23 17:28:12 roberto Exp roberto $ +** $Id: liolib.c,v 1.110 2001/03/06 20:09:38 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -11,6 +11,7 @@ #include #include +#define LUA_PRIVATE #include "lua.h" #include "lauxlib.h" @@ -353,9 +354,10 @@ static int io_write (lua_State *L) { int arg; int status = 1; for (arg=1; arg<=nargs; arg++) { - if (lua_type(L, arg) == LUA_TNUMBER) { /* LUA_NUMBER */ + if (lua_type(L, arg) == LUA_TNUMBER) { /* optimization: could be done exactly as for strings */ - status = status && fprintf(f, l_s("%.16g"), lua_tonumber(L, arg)) > 0; + status = status && + fprintf(f, l_s(LUA_NUMBER_FMT), lua_tonumber(L, arg)) > 0; } else { size_t l; @@ -638,7 +640,7 @@ static int errorfb (lua_State *L) { luaL_addstring(&b, l_s("\n")); } luaL_pushresult(&b); - lua_getglobal(L, LUA_ALERT); + lua_getglobal(L, l_s(LUA_ALERT)); if (lua_isfunction(L, -1)) { /* avoid loop if _ALERT is not defined */ lua_pushvalue(L, -2); /* error message */ lua_rawcall(L, 1, 0); @@ -671,7 +673,7 @@ static const luaL_reg iolib[] = { {l_s("tmpname"), io_tmpname}, {l_s("write"), io_write}, {l_s("writeto"), io_writeto}, - {LUA_ERRORMESSAGE, errorfb} + {l_s(LUA_ERRORMESSAGE), errorfb} }; -- cgit v1.2.3-55-g6feb