From 36b6fdda833d4dd4a866d2c96ac42062b2b29af9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Fri, 17 Mar 1995 17:42:20 -0300 Subject: function "type" now returns a second result: the tag of the type, so lua can discriminate different kinds of user data. --- inout.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'inout.c') diff --git a/inout.c b/inout.c index ac89a1b7..b6c4e768 100644 --- a/inout.c +++ b/inout.c @@ -5,7 +5,7 @@ ** Also provides some predefined lua functions. */ -char *rcs_inout="$Id: inout.c,v 2.16 1994/12/20 21:20:36 roberto Exp celes $"; +char *rcs_inout="$Id: inout.c,v 2.17 1995/03/17 20:27:11 celes Exp roberto $"; #include <stdio.h> #include <stdlib.h> @@ -235,9 +235,11 @@ void lua_print (void) void luaI_type (void) { lua_Object o = lua_getparam(1); + int t; if (o == LUA_NOOBJECT) lua_error("no parameter to function 'type'"); - switch (lua_type(o)) + t = lua_type(o); + switch (t) { case LUA_T_NIL : lua_pushliteral("nil"); @@ -261,6 +263,7 @@ void luaI_type (void) lua_pushliteral("userdata"); break; } + lua_pushnumber(t); } /* -- cgit v1.2.3-55-g6feb