aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-30 11:07:48 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-30 11:07:48 -0200
commite42a219eebd2e4c6f11f8b175d3d0e0f6678b48c (patch)
treec7bb9d8ce462651b9b7749088819052da5145d03
parentb3959d58ffc60bbfd288ffa8bf2e9ef19b7a862d (diff)
downloadlua-e42a219eebd2e4c6f11f8b175d3d0e0f6678b48c.tar.gz
lua-e42a219eebd2e4c6f11f8b175d3d0e0f6678b48c.tar.bz2
lua-e42a219eebd2e4c6f11f8b175d3d0e0f6678b48c.zip
`lua_typename' accepts LUA_TNONE
-rw-r--r--lauxlib.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lauxlib.c b/lauxlib.c
index a817f613..5d122ed3 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.41 2000/10/27 16:15:53 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.42 2000/10/30 12:38:50 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*/
@@ -41,10 +41,9 @@ LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
41 41
42 42
43static void type_error (lua_State *L, int narg, int t) { 43static void type_error (lua_State *L, int narg, int t) {
44 char buff[100]; 44 char buff[50];
45 int tt = lua_type(L, narg); 45 sprintf(buff, "%.8s expected, got %.8s", lua_typename(L, t),
46 const char *rt = (tt == LUA_TNONE) ? "no value" : lua_typename(L, tt); 46 lua_typename(L, lua_type(L, narg)));
47 sprintf(buff, "%.10s expected, got %.10s", lua_typename(L, t), rt);
48 luaL_argerror(L, narg, buff); 47 luaL_argerror(L, narg, buff);
49} 48}
50 49