diff options
-rw-r--r-- | lauxlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.140 2005/07/12 14:32:48 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.141 2005/07/13 19:02:42 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 | */ |
@@ -42,7 +42,8 @@ | |||
42 | 42 | ||
43 | LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { | 43 | LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { |
44 | lua_Debug ar; | 44 | lua_Debug ar; |
45 | lua_getstack(L, 0, &ar); | 45 | if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ |
46 | return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); | ||
46 | lua_getinfo(L, "n", &ar); | 47 | lua_getinfo(L, "n", &ar); |
47 | if (strcmp(ar.namewhat, "method") == 0) { | 48 | if (strcmp(ar.namewhat, "method") == 0) { |
48 | narg--; /* do not count `self' */ | 49 | narg--; /* do not count `self' */ |