aboutsummaryrefslogtreecommitdiff
path: root/iolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-03-19 19:28:37 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-03-19 19:28:37 -0300
commita275d9a25b161af426696d7b73d46f91150309c9 (patch)
tree763a5694213fe30b231bc81777cec71828935696 /iolib.c
parent7e0be1fbde80d72886e11bcbf114a8dbf6d5e1d9 (diff)
downloadlua-a275d9a25b161af426696d7b73d46f91150309c9.tar.gz
lua-a275d9a25b161af426696d7b73d46f91150309c9.tar.bz2
lua-a275d9a25b161af426696d7b73d46f91150309c9.zip
functions "lua_is..." consider coercions.
Diffstat (limited to 'iolib.c')
-rw-r--r--iolib.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/iolib.c b/iolib.c
index ed6ead8d..a6ae51bd 100644
--- a/iolib.c
+++ b/iolib.c
@@ -3,7 +3,7 @@
3** Input/output library to LUA 3** Input/output library to LUA
4*/ 4*/
5 5
6char *rcs_iolib="$Id: iolib.c,v 1.38 1996/03/12 15:56:03 roberto Exp roberto $"; 6char *rcs_iolib="$Id: iolib.c,v 1.39 1996/03/14 15:55:18 roberto Exp roberto $";
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include <ctype.h> 9#include <ctype.h>
@@ -422,9 +422,10 @@ static void io_write (void)
422 if (lua_getparam (2) == LUA_NOOBJECT) /* free format */ 422 if (lua_getparam (2) == LUA_NOOBJECT) /* free format */
423 { 423 {
424 lua_Object o1 = lua_getparam(1); 424 lua_Object o1 = lua_getparam(1);
425 if (lua_isnumber(o1)) 425 int t = lua_type(o1);
426 if (t == LUA_T_NUMBER)
426 status = fprintf (out, "%g", lua_getnumber(o1)) >= 0; 427 status = fprintf (out, "%g", lua_getnumber(o1)) >= 0;
427 else if (lua_isstring(o1)) 428 else if (t == LUA_T_STRING)
428 status = fprintf (out, "%s", lua_getstring(o1)) >= 0; 429 status = fprintf (out, "%s", lua_getstring(o1)) >= 0;
429 } 430 }
430 else /* formated */ 431 else /* formated */