diff options
| author | Lua Team <team@lua.org> | 2005-11-18 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2005-11-18 12:00:00 +0000 |
| commit | b3196343ba1a5dfe10e68eb9c61dc0ad5bb961a8 (patch) | |
| tree | d3efede68270d3986c0f78101e55d17577a62666 /src/loslib.c | |
| parent | bd80c4ee9b6d9464cf9f3ff4ee41890d8b3ca9e6 (diff) | |
| download | lua-github-b3196343ba1a5dfe10e68eb9c61dc0ad5bb961a8.tar.gz | |
Lua 5.1-beta5.1-beta
Diffstat (limited to 'src/loslib.c')
| -rw-r--r-- | src/loslib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/loslib.c b/src/loslib.c index 4cee7ba5..01458b90 100644 --- a/src/loslib.c +++ b/src/loslib.c @@ -1,5 +1,5 @@ /* -** $Id: loslib.c,v 1.13 2005/09/09 18:22:46 roberto Exp $ +** $Id: loslib.c,v 1.14 2005/10/21 13:47:42 roberto Exp $ ** Standard Operating System library ** See Copyright Notice in lua.h */ @@ -125,8 +125,8 @@ static int getfield (lua_State *L, const char *key, int d) { static int io_date (lua_State *L) { const char *s = luaL_optstring(L, 1, "%c"); - lua_Number n = luaL_optnumber(L, 2, -1); - time_t t = (n == -1) ? time(NULL) : (time_t)n; + time_t t = lua_isnoneornil(L, 2) ? time(NULL) : + (time_t)luaL_checknumber(L, 2); struct tm *stm; if (*s == '!') { /* UTC? */ stm = gmtime(&t); |
