From a275d9a25b161af426696d7b73d46f91150309c9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 19 Mar 1996 19:28:37 -0300 Subject: functions "lua_is..." consider coercions. --- iolib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'iolib.c') diff --git a/iolib.c b/iolib.c index ed6ead8d..a6ae51bd 100644 --- a/iolib.c +++ b/iolib.c @@ -3,7 +3,7 @@ ** Input/output library to LUA */ -char *rcs_iolib="$Id: iolib.c,v 1.38 1996/03/12 15:56:03 roberto Exp roberto $"; +char *rcs_iolib="$Id: iolib.c,v 1.39 1996/03/14 15:55:18 roberto Exp roberto $"; #include #include @@ -422,9 +422,10 @@ static void io_write (void) if (lua_getparam (2) == LUA_NOOBJECT) /* free format */ { lua_Object o1 = lua_getparam(1); - if (lua_isnumber(o1)) + int t = lua_type(o1); + if (t == LUA_T_NUMBER) status = fprintf (out, "%g", lua_getnumber(o1)) >= 0; - else if (lua_isstring(o1)) + else if (t == LUA_T_STRING) status = fprintf (out, "%s", lua_getstring(o1)) >= 0; } else /* formated */ -- cgit v1.2.3-55-g6feb