Fixed bug in tail calls of __call chains
A tail call of a __call chain (a __call metamethod that itself is also not a function) was being perfomed as a regular call.
This commit is contained in:
3
lvm.c
3
lvm.c
@@ -1549,9 +1549,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
|
||||
luaF_close(L, base, NOCLOSINGMETH);
|
||||
lua_assert(base == ci->func + 1);
|
||||
}
|
||||
if (!ttisfunction(s2v(ra))) { /* not a function? */
|
||||
while (!ttisfunction(s2v(ra))) { /* not a function? */
|
||||
luaD_tryfuncTM(L, ra); /* try '__call' metamethod */
|
||||
b++; /* there is now one extra argument */
|
||||
checkstackp(L, 1, ra);
|
||||
}
|
||||
if (!ttisLclosure(s2v(ra))) { /* C function? */
|
||||
luaD_call(L, ra, LUA_MULTRET); /* call it */
|
||||
|
||||
Reference in New Issue
Block a user