'lua_toclose' gets the index to be closed as an argument

Sometimes it is useful to mark to-be-closed an index that is not
at the top of the stack (e.g., if the value to be closed came from
a function call returning multiple values).
This commit is contained in:
Roberto Ierusalimschy
2018-11-12 14:15:50 -02:00
parent 9eafe9c053
commit 5fda30b4f9
4 changed files with 22 additions and 13 deletions

View File

@@ -1551,7 +1551,7 @@ static struct X { int x; } x;
return lua_yieldk(L1, nres, i, Cfunck);
}
else if EQ("toclose") {
lua_toclose(L);
lua_toclose(L, getnum);
}
else luaL_error(L, "unknown instruction %s", buff);
}