Browse Source

new macro `luaL_typename'

Roberto Ierusalimschy 21 years ago
parent
commit
7a796a0682
4 changed files with 8 additions and 7 deletions
  1. 2 2
      lauxlib.c
  2. 2 1
      lauxlib.h
  3. 2 2
      lbaselib.c
  4. 2 2
      ltests.c

+ 2 - 2
lauxlib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lauxlib.c,v 1.118 2004/06/29 16:57:56 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.119 2004/07/01 14:26:28 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -63,7 +63,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
 
 
 LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
 LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
   const char *msg = lua_pushfstring(L, "%s expected, got %s",
   const char *msg = lua_pushfstring(L, "%s expected, got %s",
-                                    tname, lua_typename(L, lua_type(L,narg)));
+                                    tname, luaL_typename(L, narg));
   return luaL_argerror(L, narg, msg);
   return luaL_argerror(L, narg, msg);
 }
 }
 
 

+ 2 - 1
lauxlib.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lauxlib.h,v 1.68 2004/06/29 16:57:56 roberto Exp roberto $
+** $Id: lauxlib.h,v 1.69 2004/06/30 12:58:44 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -86,6 +86,7 @@ LUALIB_API lua_State *(luaL_newstate) (void);
 #define luaL_checklong(L,n)	((long)luaL_checkinteger(L, n))
 #define luaL_checklong(L,n)	((long)luaL_checkinteger(L, n))
 #define luaL_optlong(L,n,d)	((long)luaL_optinteger(L, n,d))
 #define luaL_optlong(L,n,d)	((long)luaL_optinteger(L, n,d))
 
 
+#define luaL_typename(L,i)	lua_typename(L,lua_type(L,(i)))
 
 
 /*
 /*
 ** {======================================================
 ** {======================================================

+ 2 - 2
lbaselib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lbaselib.c,v 1.152 2004/07/02 18:09:11 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.153 2004/07/09 16:01:38 roberto Exp roberto $
 ** Basic library
 ** Basic library
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -195,7 +195,7 @@ static int luaB_collectgarbage (lua_State *L) {
 
 
 static int luaB_type (lua_State *L) {
 static int luaB_type (lua_State *L) {
   luaL_checkany(L, 1);
   luaL_checkany(L, 1);
-  lua_pushstring(L, lua_typename(L, lua_type(L, 1)));
+  lua_pushstring(L, luaL_typename(L, 1));
   return 1;
   return 1;
 }
 }
 
 

+ 2 - 2
ltests.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ltests.c,v 2.8 2004/05/31 19:41:52 roberto Exp roberto $
+** $Id: ltests.c,v 2.9 2004/06/02 19:08:52 roberto Exp roberto $
 ** Internal Module for Debugging of the Lua Implementation
 ** Internal Module for Debugging of the Lua Implementation
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -951,7 +951,7 @@ static int testC (lua_State *L) {
         lua_pushnil(L1);
         lua_pushnil(L1);
     }
     }
     else if EQ("type") {
     else if EQ("type") {
-      lua_pushstring(L1, lua_typename(L1, lua_type(L1, getnum)));
+      lua_pushstring(L1, luaL_typename(L1, getnum));
     }
     }
     else if EQ("getn") {
     else if EQ("getn") {
       int i = getnum;
       int i = getnum;