diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-07-09 15:23:17 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-07-09 15:23:17 -0300 |
| commit | 7a796a0682e8d0a4e3798955f5db64255d9bd44d (patch) | |
| tree | bf7c79070525af27e11d494fd3c98f15bf1eee0d | |
| parent | 76d8b8db06f7ae23da1543e1bf0a195d92b633a9 (diff) | |
| download | lua-7a796a0682e8d0a4e3798955f5db64255d9bd44d.tar.gz lua-7a796a0682e8d0a4e3798955f5db64255d9bd44d.tar.bz2 lua-7a796a0682e8d0a4e3798955f5db64255d9bd44d.zip | |
new macro `luaL_typename'
| -rw-r--r-- | lauxlib.c | 4 | ||||
| -rw-r--r-- | lauxlib.h | 3 | ||||
| -rw-r--r-- | lbaselib.c | 4 | ||||
| -rw-r--r-- | ltests.c | 4 |
4 files changed, 8 insertions, 7 deletions
| @@ -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 | ||
| 64 | LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { | 64 | LUALIB_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 | ||
| @@ -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 | ** {====================================================== |
| @@ -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 | ||
| 196 | static int luaB_type (lua_State *L) { | 196 | static 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 | ||
| @@ -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; |
