I had a look at ldb, and the author implements breakpoints in a similar
fashion, and talks about "simulated local environment". His breakpoints are
of the form "function dummy (args) block end", evaluated, then lua_ref'ed,
and when a breakpoints location is hit, the reference is read and the
function evaluated. The author also uses lua_beginblock() and
lua_endblock(), which seems 3.x-specific. What does it do ? I suppose it is
equivalent to the pair int top = lua_gettop(L) / lua_settop(L,top) ? I also
see that when evaluating an expression, ldb takes all locals of the current
context, and makes globals of them, saving the masked global's value
somewhere, and restores those values after the expression is evaluated. Is
there really no other means to access local values ? I will do the same if
it is the only way, but if there is another solution I am interested :-)