diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-07-12 15:11:58 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-07-12 15:11:58 -0300 |
| commit | ae1cf64348ca7bcb6d3abb19a0b97918e343914c (patch) | |
| tree | 23bd25ec0cc4d29ad62a64fad039495fbbee8bb5 /lauxlib.c | |
| parent | a264fd089e1814bc13d6de924b928959af2e38d9 (diff) | |
| download | lua-ae1cf64348ca7bcb6d3abb19a0b97918e343914c.tar.gz lua-ae1cf64348ca7bcb6d3abb19a0b97918e343914c.tar.bz2 lua-ae1cf64348ca7bcb6d3abb19a0b97918e343914c.zip | |
better names for type-related functions
Diffstat (limited to 'lauxlib.c')
| -rw-r--r-- | lauxlib.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.49 2001/03/26 14:31:49 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.50 2001/04/23 16:35:45 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 | */ |
| @@ -44,7 +44,7 @@ LUALIB_API void luaL_argerror (lua_State *L, int narg, const l_char *extramsg) { | |||
| 44 | 44 | ||
| 45 | static void type_error (lua_State *L, int narg, const l_char *tname) { | 45 | static void type_error (lua_State *L, int narg, const l_char *tname) { |
| 46 | l_char buff[80]; | 46 | l_char buff[80]; |
| 47 | sprintf(buff, l_s("%.25s expected, got %.25s"), tname, lua_xtypename(L,narg)); | 47 | sprintf(buff, l_s("%.25s expected, got %.25s"), tname, lua_type(L,narg)); |
| 48 | luaL_argerror(L, narg, buff); | 48 | luaL_argerror(L, narg, buff); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -61,20 +61,20 @@ LUALIB_API void luaL_checkstack (lua_State *L, int space, const l_char *mes) { | |||
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | LUALIB_API void luaL_checktype(lua_State *L, int narg, int t) { | 63 | LUALIB_API void luaL_checktype(lua_State *L, int narg, int t) { |
| 64 | if (lua_type(L, narg) != t) | 64 | if (lua_rawtag(L, narg) != t) |
| 65 | tag_error(L, narg, t); | 65 | tag_error(L, narg, t); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | LUALIB_API void luaL_checkany (lua_State *L, int narg) { | 69 | LUALIB_API void luaL_checkany (lua_State *L, int narg) { |
| 70 | if (lua_type(L, narg) == LUA_TNONE) | 70 | if (lua_rawtag(L, narg) == LUA_TNONE) |
| 71 | luaL_argerror(L, narg, l_s("value expected")); | 71 | luaL_argerror(L, narg, l_s("value expected")); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, | 75 | LUALIB_API void *luaL_check_userdata (lua_State *L, int narg, |
| 76 | const l_char *name) { | 76 | const l_char *name) { |
| 77 | if (strcmp(lua_xtypename(L, narg), name) != 0) | 77 | if (strcmp(lua_type(L, narg), name) != 0) |
| 78 | type_error(L, narg, name); | 78 | type_error(L, narg, name); |
| 79 | return lua_touserdata(L, narg); | 79 | return lua_touserdata(L, narg); |
| 80 | } | 80 | } |
