mirror of
https://github.com/lua/lua
synced 2024-11-26 14:51:21 +03:00
correct #args for calls with self (a:foo(...))
This commit is contained in:
parent
c3b90061ea
commit
f438d00ef3
@ -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
|
** Auxiliary functions for building Lua libraries
|
||||||
** See Copyright Notice in lua.h
|
** 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_Debug ar;
|
||||||
lua_getstack(L, 0, &ar);
|
lua_getstack(L, 0, &ar);
|
||||||
lua_getinfo(L, "n", &ar);
|
lua_getinfo(L, "n", &ar);
|
||||||
|
if (strcmp(ar.namewhat, "method") == 0) narg--; /* do not count `self' */
|
||||||
if (ar.name == NULL)
|
if (ar.name == NULL)
|
||||||
ar.name = "?";
|
ar.name = "?";
|
||||||
luaL_verror(L, "bad argument #%d to `%.50s' (%.100s)",
|
luaL_verror(L, "bad argument #%d to `%.50s' (%.100s)",
|
||||||
|
Loading…
Reference in New Issue
Block a user