My apologies, I seemed to have confused myself when testing your solution
earlier. Trying it again now and it seems to work.
Thank you!
On Sat, Nov 5, 2016 at 3:37 PM, Peter Cawley <corsix@xxxxxxxxxx> wrote:
On Sat, Nov 5, 2016 at 10:26 PM, Brandon Bloom
<brandon.d.bloom@xxxxxxxxx> wrote:
If the withx call itself is not in tail position, that code will fail to
restore the old value of x.
I don't quite follow. If the withx call is not in tail position, then
`debug.getinfo(2, "f").func` will give the function which called
withx. That function will not be equal to withx, and consequently the
withx call will save and restore x.