Kaj Eijlers <bizziboi@xxxxxxxxx> wrote: > My first question would be, is it indeed guaranteed that bar() does > something irrelevant? It could be assigning to a local variable N while > forgetting to declare it - and give the issue you see? Sorry the handler snippet should be: foo:push_handler( function () for i = 1, N do -- // PROBLEM HERE // if i < 0 or i > 4 then print(i, N) -- got i = 5, N = 4 end bar(foo, i) end end) I can guarantee that the local variable N has not been modified during the bar() is called. Thank you for pointing that out.