diff -Naur lua-5.1.5/src/ldblib.c arity-version/src/ldblib.c --- lua-5.1.5/src/ldblib.c 2009年08月04日 20:50:18.000000000 +0200 +++ arity-version/src/ldblib.c 2012年09月25日 09:58:46.000000000 +0200 @@ -133,6 +133,9 @@ settabss(L, "name", ar.name); settabss(L, "namewhat", ar.namewhat); } + if (strchr(options, 'a')) { + settabsi(L, "arity", ar.arity); + } if (strchr(options, 'L')) treatstackoption(L, L1, "activelines"); if (strchr(options, 'f')) diff -Naur lua-5.1.5/src/ldebug.c arity-version/src/ldebug.c --- lua-5.1.5/src/ldebug.c 2008年05月08日 18:56:26.000000000 +0200 +++ arity-version/src/ldebug.c 2012年09月25日 10:25:24.000000000 +0200 @@ -219,6 +219,19 @@ } break; } + case 'a': { + if(f->c.isC) { + ar->arity = -1; + } else { + struct Proto *p = f->l.p; + if(p->is_vararg) { + ar->arity = -1; + } else { + ar->arity = p->numparams; + } + } + break; + } case 'L': case 'f': /* handled by lua_getinfo */ break; diff -Naur lua-5.1.5/src/lua.h arity-version/src/lua.h --- lua-5.1.5/src/lua.h 2012年01月13日 21:36:20.000000000 +0100 +++ arity-version/src/lua.h 2012年09月25日 09:56:20.000000000 +0200 @@ -354,6 +354,7 @@ int linedefined; /* (S) */ int lastlinedefined; /* (S) */ char short_src[LUA_IDSIZE]; /* (S) */ + int arity; /* (a) */ /* private part */ int i_ci; /* active function */ };