commit f438d00ef31e3aea54023602f529b68834ffb80a
parent c3b90061ea8c9add053538945ac85188e48e48b1
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 4 Apr 2002 17:25:33 -0300
correct #args for calls with self (a:foo(...))
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lauxlib.c b/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.63 2002/03/27 15:30:41 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.64 2002/04/02 20:42:49 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -46,6 +46,7 @@ LUALIB_API void luaL_argerror (lua_State *L, int narg, const char *extramsg) {
lua_Debug ar;
lua_getstack(L, 0, &ar);
lua_getinfo(L, "n", &ar);
+ if (strcmp(ar.namewhat, "method") == 0) narg--; /* do not count `self' */
if (ar.name == NULL)
ar.name = "?";
luaL_verror(L, "bad argument #%d to `%.50s' (%.100s)",