`lua_typename' accepts LUA_TNONE

This commit is contained in:
Roberto Ierusalimschy 2000-10-30 11:07:48 -02:00
parent b3959d58ff
commit e42a219eeb
1 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lauxlib.c,v 1.41 2000/10/27 16:15:53 roberto Exp roberto $ ** $Id: lauxlib.c,v 1.42 2000/10/30 12:38:50 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
*/ */
@ -41,10 +41,9 @@ LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
static void type_error (lua_State *L, int narg, int t) { static void type_error (lua_State *L, int narg, int t) {
char buff[100]; char buff[50];
int tt = lua_type(L, narg); sprintf(buff, "%.8s expected, got %.8s", lua_typename(L, t),
const char *rt = (tt == LUA_TNONE) ? "no value" : lua_typename(L, tt); lua_typename(L, lua_type(L, narg)));
sprintf(buff, "%.10s expected, got %.10s", lua_typename(L, t), rt);
luaL_argerror(L, narg, buff); luaL_argerror(L, narg, buff);
} }