aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-07-09 15:23:17 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-07-09 15:23:17 -0300
commit7a796a0682e8d0a4e3798955f5db64255d9bd44d (patch)
treebf7c79070525af27e11d494fd3c98f15bf1eee0d
parent76d8b8db06f7ae23da1543e1bf0a195d92b633a9 (diff)
downloadlua-7a796a0682e8d0a4e3798955f5db64255d9bd44d.tar.gz
lua-7a796a0682e8d0a4e3798955f5db64255d9bd44d.tar.bz2
lua-7a796a0682e8d0a4e3798955f5db64255d9bd44d.zip
new macro `luaL_typename'
-rw-r--r--lauxlib.c4
-rw-r--r--lauxlib.h3
-rw-r--r--lbaselib.c4
-rw-r--r--ltests.c4
4 files changed, 8 insertions, 7 deletions
diff --git a/lauxlib.c b/lauxlib.c
index d465042e..956f4950 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.118 2004/06/29 16:57:56 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.119 2004/07/01 14:26:28 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -63,7 +63,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
63 63
64LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { 64LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
65 const char *msg = lua_pushfstring(L, "%s expected, got %s", 65 const char *msg = lua_pushfstring(L, "%s expected, got %s",
66 tname, lua_typename(L, lua_type(L,narg))); 66 tname, luaL_typename(L, narg));
67 return luaL_argerror(L, narg, msg); 67 return luaL_argerror(L, narg, msg);
68} 68}
69 69
diff --git a/lauxlib.h b/lauxlib.h
index 3b2ceb2b..1a0295d6 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.68 2004/06/29 16:57:56 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.69 2004/06/30 12:58:44 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -86,6 +86,7 @@ LUALIB_API lua_State *(luaL_newstate) (void);
86#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, n)) 86#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, n))
87#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, n,d)) 87#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, n,d))
88 88
89#define luaL_typename(L,i) lua_typename(L,lua_type(L,(i)))
89 90
90/* 91/*
91** {====================================================== 92** {======================================================
diff --git a/lbaselib.c b/lbaselib.c
index 036a4c9d..c3a8cb5e 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.152 2004/07/02 18:09:11 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.153 2004/07/09 16:01:38 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -195,7 +195,7 @@ static int luaB_collectgarbage (lua_State *L) {
195 195
196static int luaB_type (lua_State *L) { 196static int luaB_type (lua_State *L) {
197 luaL_checkany(L, 1); 197 luaL_checkany(L, 1);
198 lua_pushstring(L, lua_typename(L, lua_type(L, 1))); 198 lua_pushstring(L, luaL_typename(L, 1));
199 return 1; 199 return 1;
200} 200}
201 201
diff --git a/ltests.c b/ltests.c
index 8b9226ae..5f3b4bba 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.8 2004/05/31 19:41:52 roberto Exp roberto $ 2** $Id: ltests.c,v 2.9 2004/06/02 19:08:52 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -951,7 +951,7 @@ static int testC (lua_State *L) {
951 lua_pushnil(L1); 951 lua_pushnil(L1);
952 } 952 }
953 else if EQ("type") { 953 else if EQ("type") {
954 lua_pushstring(L1, lua_typename(L1, lua_type(L1, getnum))); 954 lua_pushstring(L1, luaL_typename(L1, getnum));
955 } 955 }
956 else if EQ("getn") { 956 else if EQ("getn") {
957 int i = getnum; 957 int i = getnum;