diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-19 10:48:53 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-02-19 10:48:53 -0300 |
| commit | a4c6dcf999ddea865e295ea34926a838a1f97b61 (patch) | |
| tree | b539e4004df0caa7b1a37ccffe3754c3e4f3fa23 | |
| parent | 3f78de256e5759669460c6fa14455303762f2f53 (diff) | |
| download | lua-a4c6dcf999ddea865e295ea34926a838a1f97b61.tar.gz lua-a4c6dcf999ddea865e295ea34926a838a1f97b61.tar.bz2 lua-a4c6dcf999ddea865e295ea34926a838a1f97b61.zip | |
detail (better error messages for light userdata)
| -rw-r--r-- | lauxlib.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.257 2014/02/05 19:14:53 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.258 2014/02/11 17:39:15 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 | */ |
| @@ -176,6 +176,8 @@ static int typeerror (lua_State *L, int arg, const char *tname) { | |||
| 176 | if (lua_isstring(L, -1)) | 176 | if (lua_isstring(L, -1)) |
| 177 | typearg = lua_tostring(L, -1); | 177 | typearg = lua_tostring(L, -1); |
| 178 | } | 178 | } |
| 179 | else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) | ||
| 180 | typearg = "light userdata"; | ||
| 179 | msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); | 181 | msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); |
| 180 | return luaL_argerror(L, arg, msg); | 182 | return luaL_argerror(L, arg, msg); |
| 181 | } | 183 | } |
